[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1204101239.6242.372.camel@lappy>
Date: Wed, 27 Feb 2008 09:33:58 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Pekka Enberg <penberg@...helsinki.fi>
Cc: Neil Brown <neilb@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
netdev@...r.kernel.org, trond.myklebust@....uio.no
Subject: Re: [PATCH 00/28] Swap over NFS -v16
On Wed, 2008-02-27 at 09:14 +0100, Peter Zijlstra wrote:
> On Wed, 2008-02-27 at 10:05 +0200, Pekka Enberg wrote:
> > Hi Peter,
> >
> > On Wed, Feb 27, 2008 at 9:58 AM, Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
> > > > 1/ I note there is no way to tell if memory returned by kmalloc is
> > > > from the emergency reserve - which contrasts with alloc_page
> > > > which does make that information available through page->reserve.
> > > > This seems a slightly unfortunate aspect of the interface.
> > >
> > > Yes, but alas there is no room to store such information in kmalloc().
> > > That is, in a sane way. I think it was Daniel Phillips who suggested
> > > encoding it in the return pointer by flipping the low bit - but that is
> > > just too ugly and breaks all current kmalloc sites to boot.
> >
> > Why can't you add a kmem_is_emergency() to SLUB that looks up the
> > cache/slab/page (whatever is the smallest unit of the emergency pool
> > here) for the object and use that?
>
> There is an idea.. :-) It would mean preserving page->reserved, but SLUB
> has plenty of page flags to pick from. Or maybe I should move the thing
> to a page flag anyway. If we do that SLAB would allow something similar,
> just look up the page for whatever address you get and look at PG_emerg
> or something.
>
> Having this would clean things up. I'll go work on this.
Humm, and here I sit staring at the screen. Perhaps I should go get my
morning juice, but...
if (mem_reserve_kmalloc_charge(my_res, sizeof(*foo), 0)) {
foo = kmalloc(sizeof(*foo), gfp|__GFP_MEMALLOC)
if (!kmem_is_emergency(foo))
mem_reserve_kmalloc_charge(my_res, -sizeof(*foo), 0)
} else
foo = kmalloc(sizeof(*foo), gfp);
Just doesn't look too pretty..
And needing to always account the allocation seems wrong.. but I'll take
poison and see if that wakes up my mind.
--
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