Re: Caches in modules

From: Tigran Aivazian (tigran@sco.COM)
Date: Thu Feb 24 2000 - 10:44:29 EST

Hi Rik,

On Thu, 24 Feb 2000, Rik van Riel wrote:
> On Thu, 24 Feb 2000, Tigran Aivazian wrote:
> > > I'm trying to implement a cache in a module.
> >
> > presumably you have investigated using general-purpose cache
> > manager, i.e. slab allocator and found it to be inadequate for
> > your specific needs?
> No memory pressure is exerted on the slab cache, all we
> do is agressively reclaim pages that contain unused
> entries only...

I thought my example of inodes was trying to say exactly the same, i.e.
even if one frees lots of objects living in the same pages as some other
objects which are not unused then reaping the slab cache won't resolve the
fragmentation issue.

> I think registering a cache with do_try_to_free_pages()
> is a good idea. It allows for a more flexible architecture
> where drivers can register and unregister caches at their
> whim and still have their caches shrunk on demand if there's
> memory pressure.

definitely. Not just drivers, but filesystems too. (but you probably meant
that inclusive). E.g. I like the Linux idea of filesystem-independent
inode cache (because it makes easy to write a filesystem) but sometimes
subsystem-specific caches do make sense, i.e. when a subsystem can predict
the usage pattern better than even the best GP cache manager like slab

Tigran A. Aivazian |
Escalations Research Group | tel: +44-(0)1923-813796
Santa Cruz Operation Ltd |

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:10 EST