Subject: Re: memory tester shows up swap/page tuning bug [was Re: BUFFERCACHE,
To: None <tech-kern@NetBSD.ORG>
From: Christoph Badura <bad@flatlin.ka.sub.org>
List: tech-kern
Date: 09/17/1996 02:27:00
Wolfgang Solfrank writes:
> Jonathan Stone writes:
>> If I understand John's patch, it works because it's re-invoking the
>> the pageout daemon anytime a low free-pages condition is signalled (by
>> a wakeup on the relevant variable, e.g., from swap_pages_iodone(),
>> after a pageout to swap backing store completes.)

This is what is supposed to happen according to the 4th paragraph on
page 166 of the 4.4BSD demon book:

   "...  *Whenever* an operation that uses pages causes the amount of
    free memory to fall below this threshold [5% of the memory], the
    pageout daemon is awakened."   The emphasis is mine.

Ultimately, this means that the pageout daemon must sleep on a single
wait channel or else it will miss wakeups.  If it also needs to be
awakend once a second, it can't be sleeping on lbolt but must use a
timeout() or the code that wakes up processes sleeping on lbolt should
be changed to also wake up the page daemon.

I guess, someone needs to go through the page daemon code and find
all the wait channels it sleeps on...  Wolfgang?

>Well, actually it's simpler than this. Without John's patch the sleep is for
>one second. With John's patch it sleeps till the next time that vm_pages_needed
>is wakeup'ed. This may be done by something signalling low free-pages condition.

Which seems correct to me.

>The reasons that the pageout sleeps at the place that gets modified by John's
>patch is some resource shortage in a pager. Now if the resource shortage is in
>the swap pager (which is probably the case in your frozen situation), the
>finishing of an I/O operation in the swap pager will call swap_pager_iodone
>(in swap_pager.c) which does a wakeup on vm_pages_needed, so voila, the pageout
>daemon gets woken up.

Seems correct too.
-- 
Christoph Badura	bad@flatlin.ka.sub.org

You don't need to quote my .signature.  Everyone has seen it by now.
Besides, it doesn't add anything to the current thread.