Re: Question on swapping behavior of new kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arn...

On Fri, Aug 29, 2008 at 8:33 AM, Arn <cse.syslab@xxxxxxxxx> wrote:
> Hi,
>
> I'm using a 2.6.26 kernel on an AMD64 machine. Im running some timing
> experiments on the Linux swapping system.
> My system has 2GB of RAM but I boot linux with mem=1GB.
>
> There's is some behavior happening which I don't understand and I'm
> hoping someone can explain it to me.
>
> Here is what my experimental (simple) programs do. in sequence :
>
> 1) Process A grabs a lot of memory (calloc). It takes about 90% of memory
> 2) Process A does some reads/writes to all its allocated memory
> 3) Start process B. This also grabs a lot of memory (calloc).
> 4) Process B writes to all its allocated memory
> 5) OS swaps out Process A pages (to swap device) to make room for B
> 6) Process A does a timed read of all its pages.
>
> In this case I was expecting it to take a while to do the timed read
> since all its pages have been swapped to
> disk. However this is not the case. It takes the same amount of time
> as when I don't run Process B. This is
> counter to my understanding of how it should work.
>
> If I replace step 6) above with :
>
> 6) Process A does a timed write of all its pages
>
> Then I see the expected behavior which is that it takes a long time
> because all its pages are swapped in first.
> Why is there this discrepancy between timed reads and writes ?
> At first I thought it may be because AMD64 has a tagged cache and
> tagged TLB which causes this behaviour
> but I'm not really sure. Does anyone have an idea ?

I only have one suspicion I can offer right now: delayed page fault?

I mean...yes, calloc AFAIK will initialize all the pages with a value,
however...that task doesn't really read it, right?

So, probably kernel postpone the soft page fault of some pages (after
all, you said that you don't read all of them). Thus,complete page
fault happens on your original step 6. Eventually, it depends on your
read/write patterns too during step 2.

And don't forget there is read-ahead mechanism too. So when you
"touch" a page, few more pages are actually faulted in too
sequentially. That could add slightly more overhead (for read).

This is not a briliant answer, so feel free to CMIIW.

regards,

Mulyadi.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux