[OpenAFS-devel] [PATCH] crget() memory allocation oddity

Tom Keiser tkeiser@gmail.com
Fri, 2 Jun 2006 16:07:19 -0400


On 6/2/06, chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil> wrote:
> In message <9ECA25ADC116985E0A319855@mariner.pc.cs.cmu.edu>,Jeffrey Hutzelman w
> rites:
> >I'm not so sure.  Since the OS doesn't actually have creds like we expect,
> >we have to cons them up for every filesystem operation (that is, every time
> >crget() is called).  That's pretty frequent, and it seems appropriate to
> >avoid the overhead of memory allocation every time.
>
> but everytime we dive into crget() we are taking a mutex and grabbing
> an entry from the pool.  that's essentially what kmalloc does most of
> the time anyway.  you could save a little bit of memory not keeping
> track of the same buffers twice.  i suspect empirical testing would
> be necessary to decide if there is any perceptable difference.

Does it even acquire a mutex most of the time?  The Linux allocator is
based upon the Solaris slab allocator.  That allocator just disables
preemption and tries to satisfy the allocations out of a cpu-local
slab, only grabbing a mutex if the local allocation fails.  Our
home-grown allocators are going to need major surgery to compete with
such a highly-performant algorithm.

-Tom