Hi,
On Wed, 22 Dec 1999 21:30:54 +0100, Pavel Machek <pavel@suse.cz> said:
>> > What I tried to do is to just free _clean_ pages when short on
>> > memory.
>> I don't know if we can do it in a short piece
>> of code,
Yes, it's easy.
>> That will only work if we have clean, unshared pages in the swap or
>> page cache. I guess we want to keep count of those pages and make
>> sure that there always are enough of them.
> I was told that is "almost always" true. sct, could you comment on
> this? (This patch does not count them)
Trouble is, if you've got (say) a busy network server guzzling
GFP_ATOMIC allocations, you can't guarantee these pages.
> That's the way kreclaimd was expected to work...
> + tsk->flags |= PF_MEMALLOC;
> + while (1) {
> + while (shrink_mmap(6, 0) && count--) /* We don't want it to do any I/O */
> + ;
You really want to call do_try_to_free_pages(__GFP_SWAP). That will try
all sorts of page reclaim functions, including shrink_mmap, the dcache
shrinker and the swapper, but will never do IO. Calling the swapper is
still useful here because we may have lots of readonly memory-mapped
pages which can be thrown out without any IO, but which can't be
reclaimed by shrink_mmap() alone.
--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/
This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:09 EST