Subject: Re: pagedeamon deadlocks (2)
To: Daniel Carosone <dan@geek.com.au>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: current-users
Date: 02/29/2004 12:43:57
> One thing I haven't yet had a chance to try is moving the buf_drain
> back to the end of the pagedaemon, where it used to be.  It was moved
> to the front as part of an effort to get the bufcache to respond
> better to memory pressure, by asking it to give back memory first.
> This worked very well in stopping the buffercache growing too fast in
> general use, before the last round of other tuning efforts and
> bugfixes did even better - it may no longer be necessary.

Due to the way buf_drain() is implemented, it can also invoke I/O
operations that are not directly related to freeing up memory (see
the evidence from yamt).  One way to avoid this would be to change the
implemetation to only scan the queues for disposable buffers and leave
delayed-write buffers alone. This would add code and complexity to
the buffer cache implementation.

Another possibility is to refer the trimming of the buffer cache to the
ioflush() thread, which is already in the business of dealing with dirty
buffers and provides a context for sleeping when trying to start an I/O
operation. Since buf_drain() will only remove AGEd buffers from the system
if no memory pressure exists, I think we can get even away with simply
calling it once everytime from the ioflush thread's main loop.

-pk