Next: Networking
Up: Kernel Buffer Cache
Previous: LibOS interface
Each memory page has two independent attributes: it is either free or
allocated and it either contains a buffer or it does not. This means a
page can be in one of the following four states:
- allocated and empty: this is just a normal allocated page that is
reference counted if it is allocated by a user.
- allocated and non-empty: this is a page that contains a buffer.
It is registered with the buffer cache (ie a __bc_lookup will
succeed on it). Otherwise it is just like any other allocated page.
- free and non-empty: this is a page that no one is using but which
contains a buffer. Thus it is still registered in the buffer cache,
but it can be removed from the cache if memory gets low. Mapping this
page explicitly (ie "give me page 0x34") will map it and leave it in
the buffer cache while a generic request for memory (ie "give me a
page") will implicitly remove it from the buffer cache unless the page
is marked as dirty in which case the page will not be reclaimed.
- free and empty: this is just a normal page that no one is using
and which is not registered in the buffer cache.
Note that a free and non-empty page that is dirty will not be
implicitly removed from the buffer cache in response to a request for
more memory. This is to make sure that delayed writes are not lost by
applications that are counting on a write-back demon to do the write
back after the application as exited. If dirty pages are not cleaned
at a sufficient rate, all available memory will eventually be tied up
in dirty and therefore non-reclaimable buffers.
Next: Networking
Up: Kernel Buffer Cache
Previous: LibOS interface
Thomas Pinckney
3/17/1998