Re: [PATCH] kswapd shall not sleep during page shortage

Nick Piggin
2004-11-10T00:56:59Z

Andrew Morton wrote:

>Marcelo Tosatti <marcelo.tosatti@cyclades.com> wrote:
>
>
>>Does it makes sense to you?
>>
>
>Maybe. We really shouldn't be sending kswapd into a busy loop if all zones
>are unreclaimable. Because it could just be that there's some disk I/O in
>flight and we'll find rotated reclaimable pages available once that I/O has
>completed. (example: all of memory becomes dirty due to a large msync of
>MAP_SHARED memory). So rather than madly scanning, we should throttle
>kswapd to make it wait for I/O completions. Via blk_congestion_wait().
>That's what the total_scanned logic is supposed to do.
>
>
>

I think the patch is possibly not a good idea. Unless it fixes up
those #*%! allocation failures (*).

For OOM conditions, kswapd can be a bit lax precisely because it
doesn't oom kill things. If there is a shortage, and kswapd can't
make progress though, I think it really should sleep rather than busy
wait (albiet nicely with cond_resched()).

(*) I'm beginning to think they're due to me accidentally bumping the
page watermarks when 'fixing' them. I'll check that out presently.