[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130828063605.GD6795@lge.com>
Date: Wed, 28 Aug 2013 15:36:06 +0900
From: Joonsoo Kim <iamjoonsoo.kim@....com>
To: Jonathan Corbet <corbet@....net>
Cc: Pekka Enberg <penberg@...nel.org>,
Christoph Lameter <cl@...ux.com>,
Andrew Morton <akpm@...ux-foundation.org>,
David Rientjes <rientjes@...gle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 07/16] slab: overloading the RCU head over the LRU for
RCU free
Hello,
On Tue, Aug 27, 2013 at 04:06:04PM -0600, Jonathan Corbet wrote:
> On Thu, 22 Aug 2013 17:44:16 +0900
> Joonsoo Kim <iamjoonsoo.kim@....com> wrote:
>
> > With build-time size checking, we can overload the RCU head over the LRU
> > of struct page to free pages of a slab in rcu context. This really help to
> > implement to overload the struct slab over the struct page and this
> > eventually reduce memory usage and cache footprint of the SLAB.
>
> So I'm taking a look at this, trying to figure out what's actually in
> struct page while this stuff is going on without my head exploding. A
> couple of questions come to mind.
>
> > static void kmem_rcu_free(struct rcu_head *head)
> > {
> > - struct slab_rcu *slab_rcu = (struct slab_rcu *)head;
> > - struct kmem_cache *cachep = slab_rcu->page->slab_cache;
> > + struct kmem_cache *cachep;
> > + struct page *page;
> >
> > - kmem_freepages(cachep, slab_rcu->page);
> > + page = container_of((struct list_head *)head, struct page, lru);
> > + cachep = page->slab_cache;
> > +
> > + kmem_freepages(cachep, page);
> > }
>
> Is there a reason why you don't add the rcu_head structure as another field
> in that union alongside lru rather than playing casting games here? This
> stuff is hard enough to follow as it is without adding that into the mix.
One reason is that the SLUB is already playing this games :)
And the struct page shouldn't be enlarged unintentionally when the size of
the rcu_head is changed.
>
> The other question I had is: this field also overlays slab_page. I guess
> that, by the time RCU comes into play, there will be no further use of
> slab_page? It might be nice to document that somewhere if it's the case.
Ah..... I did a mistake in previous patch (06/16). We should leave an object
on slab_page until rcu finish the work since rcu_head is overloaded over it.
If I remove that patch, this patch has a problem you mentioned. But I think
that a fix is simple. Moving the slab_page to another union field in the
struct slab prio to this patch solves the problem you mentioned.
Thanks for pointing that!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists