tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

vmem(9) (was Re: netbsd-6: pagedaemon freeze when low on memory)

On Wed, Mar 06, 2013 at 08:05:35AM +0000, David Laight wrote:
> On Tue, Mar 05, 2013 at 11:43:35PM -0600, David Young wrote:
> >     Maybe we can avoid unnecessary locking or redundancy using a
> >     generation number?  Add a generation number to the vmem_t,
> >     
> >         volatile uint64_t vm_gen;
> > 
> >     Increase a vmem_t's generation number every
> >     time that vmem_free(), vmem_xfree(), or vmem_backend_ready() is
> >     called:
> Won't that generate a very hot cache line on a large smp system?
> Maybe the associated structures are actually worse here!
> But per-cpu virtual address free lists might make sense.

I think you mean that the line containing the generation number will
bounce rapidly between caches, which isn't efficient.  I agree with
that.  Perhaps we can reduce the cacheline bounciness induced by
vmem_{x,}free() if those routines acquire the vmem_t lock and increase
vm_gen only if they're freeing to an empty arena.  Or whatever it takes
to make the code correct as well as fast.

General comment: ISTM that vmem(9) is, and was always intended to be,
a general-purpose allocator of number intervals that may or may not
correspond to memory addresses.  I have actually used it as such.  It is
actually badly named: extent(9) is a better name, but it's taken.  Let
us keep that in mind.


David Young    Urbana, IL    (217) 721-9981

Home | Main Index | Thread Index | Old Index