Re: Allow swapping over nbd and more similar magic

Rik van Riel (riel@nl.linux.org)
Tue, 21 Dec 1999 14:35:10 +0100 (CET)


On Mon, 20 Dec 1999, Pavel Machek wrote:

> > I guess this means that you want to do two things:
> > - swap out dirty pages when we have memory left
> > - swap out / free _clean_ pages when we are short on
> > memory
>
> What I tried to do is to just free _clean_ pages when short on
> memory. I did not want to touch anything else in order not to break
> some balance. That do_try_to_free_pages(0) should kill one clean
> page. (Do you have idea how to write it in short piece of code?)

I don't know if we can do it in a short piece
of code, but I have (2.5?) ideas on how to fix
the problem for good.

> > > + while (do_try_to_free_pages(0) && count--) /* We don't want it to do any I/O */
> > > + ;
>
> Kreclaimd should not try to swap out anything...

It is trying to do just that with the call above.

> Does that mean that I should call shrink_mmap(6, 0) instead?

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.

Then we can have a kreclaimd reclaiming those pages
and kernel caches and a kswapd unmapping pages from
processes and shared memory.

That way we can also make sure that we don't use up
too many free pages and endanger atomic allocations,
and that the time pages spend in the count==1 unmapped
stage is long enough for the LRU can properly work on
them, which might give us better degradation in case
of memory pressure and (maybe) a better chance for
readahead data vs. to-be-swapped-out data.

Rik

--
The Internet is not a network of computers. It is a network
of people. That is its real strength.

- 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/