lkml.org 
[lkml]   [1998]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.1.130 mem usage.
Hi,

On Tue, 1 Dec 1998 18:12:05 +0100 (CET), Andrea Arcangeli
<andrea@e-mind.com> said:

> I read now the latest mm changes from you, Stephen. So now we have only 1
> bit to do page aging and we have an unused field in the mem_map_t.
> Logically 32 bit can give us more info than one bit. Instead of waste 32
> bit and use 1 bit, why we don' t drop the bit and use the 32 bit
> instead?

Drop the 32 instead. Having the age field forces us to do more passes
over the memory before we can free it. That can be good on low memory
if it lets us make a better decision about swapping, but on big boxes it
is unacceptable overhead.

>> + /*
>> + * If the page we looked at was recyclable but we didn't
>> + * reclaim it (presumably due to PG_referenced), don't
>> + * count it as scanned. This way, the more referenced
>> + * page cache pages we encounter, the more rapidly we
>> + * will age them.
>> + */
>> + if (atomic_read(&page->count) != 1 ||
>> + (!page->inode && !page->buffers))
>> count_min--;

> I don' t think count_min should count the number of tries on pages we have
> no chance to free. It should be the opposite according to me.

No, the objective is not to swap unnecessarily, but still to start
swapping if there is too much pressure on the cache.

If we only count recyclable pages in the count, then no matter how small
the cache is, we keep aging it until all the cache disappears before we
start swapping.

If we count non-returnable pages, then we stop looking for cache pages
once we've covered a certain amount of memory. The amount we scan in
this case increases if we find lots of referenced but freeable pages.
That is exactly what we want: the more such pages we find, the more
pages we want to scan so that we can reclaim them more easily on the
next pass. As the comment says, if we start aggressively hammering the
page cache, then this algorithm naturally starts to age cached pages
more rapidly. If the cache is already very small, then we can abort the
cache loop after having spent a bit of effort looking for, but not
finding, reusable cache pages. That is self-balancing behaviour.

> - free_page_and_swap_cache(page);
> + free_page(page);

> Doing this we are not swapping out really I think, because the page now is
> also on the hd, but it' s still in memory and so shrink_mmap() will have
> the double of the work to do.

Precisely: by forcing all the real reclaiming work to be done in one
place, we again try to make the system self-balancing.

--Stephen.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.074 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site