[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1217241541.6331.42.camel@twins>
Date: Mon, 28 Jul 2008 12:39:01 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Pekka Enberg <penberg@...helsinki.fi>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
netdev@...r.kernel.org, trond.myklebust@....uio.no,
Daniel Lezcano <dlezcano@...ibm.com>,
Neil Brown <neilb@...e.de>, mpm@...enic.com,
cl@...ux-foundation.org
Subject: Re: [PATCH 12/30] mm: memory reserve management
On Mon, 2008-07-28 at 13:29 +0300, Pekka Enberg wrote:
> > > > + }
> > > > +
> > > > + obj = __kmalloc_node_track_caller(size, flags, node, ip);
> > > > + WARN_ON(!obj);
> > >
> > > Why don't we discharge from the reserve here if !obj?
> >
> > Well, this allocation should never fail:
> > - we reserved memory
> > - we accounted/throttle its usage
> >
> > Thus this allocation should always succeed.
>
> But if it *does* fail, it doesn't help that we mess up the reservation
> counts, no?
I guess you're right there. Will fix. Thanks!
> > > > +{
> > > > + size_t size = ksize(obj);
> > > > +
> > > > + kfree(obj);
> > >
> > > We're trying to get rid of kfree() so I'd __kfree_reserve() could to
> > > mm/sl?b.c. Matt, thoughts?
> >
> > My issue with moving these helpers into mm/sl?b.c is that it would
> > require replicating all this code 3 times. Even though the functionality
> > is (or should) be invariant to the actual slab implementation.
>
> Right, I guess we could just rename ksize() to something else then and
> keep it internal to mm/.
That would be nice - we can stuff it into mm/internal.h or somesuch.
Also, you might have noticed, I still need to do everything SLOB. The
last time I rewrote all this code I was still hoping Linux would 'soon'
have a single slab allocator, but evidently we're still going with 3 for
now.. :-/
So I guess I can no longer hide behind that and will have to bite the
bullet and write the SLOB bits..
> > > > + /*
> > > > + * ksize gives the full allocated size vs the requested size we used to
> > > > + * charge; however since we round up to the nearest power of two, this
> > > > + * should all work nicely.
> > > > + */
> > > > + mem_reserve_kmalloc_charge(res, -size);
> > > > +}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists