Re: [slubllv7 05/17] mm: Rearrange struct page

From: Andrew Morton
Date: Thu Jun 09 2011 - 12:44:51 EST


On Thu, 09 Jun 2011 12:57:50 +0300 Pekka Enberg <penberg@xxxxxxxxxxxxxx> wrote:

> On 6/1/11 8:25 PM, Christoph Lameter wrote:
> > We need to be able to use cmpxchg_double on the freelist and object count
> > field in struct page. Rearrange the fields in struct page according to
> > doubleword entities so that the freelist pointer comes before the counters.
> > Do the rearranging with a future in mind where we use more doubleword
> > atomics to avoid locking of updates to flags/mapping or lru pointers.
> >
> > Create another union to allow access to counters in struct page as a
> > single unsigned long value.
> >
> > The doublewords must be properly aligned for cmpxchg_double to work.
> > Sadly this increases the size of page struct by one word on some architectures.
> > But as a resultpage structs are now cacheline aligned on x86_64.

Is it worth this cost?

> > Signed-off-by: Christoph Lameter<cl@xxxxxxxxx>
>
> I'd like to queue this SLUB patch series to linux-next through slab.git.
> Any NAKs or ACKs for this patch?
>
> > include/linux/mm_types.h | 89 +++++++++++++++++++++++++++++++----------------
> > 1 file changed, 60 insertions(+), 29 deletions(-)
> >
> > Index: linux-2.6/include/linux/mm_types.h
> > ===================================================================
> > --- linux-2.6.orig/include/linux/mm_types.h 2011-05-31 09:46:41.912987862 -0500
> > +++ linux-2.6/include/linux/mm_types.h 2011-05-31 09:46:44.282987846 -0500
> > @@ -30,52 +30,74 @@ struct address_space;
> > * moment. Note that we have no way to track which tasks are using
> > * a page, though if it is a pagecache page, rmap structures can tell us
> > * who is mapping it.
> > + *
> > + * The objects in struct page are organized in double word blocks in
> > + * order to allows us to use atomic double word operations on portions
> > + * of struct page. That is currently only used by slub but the arrangement
> > + * allows the use of atomic double word operations on the flags/mapping
> > + * and lru list pointers also.

I don't really like the word "word" much. There's always uncertainty
about whether thee and me are talking about the same thing. And
perhaps one day words will be 64-bit.

So if we mean 32-bit, let's say 32-bit?

> > +/*
> > + * If another subsystem starts using the double word pairing for atomic
> > + * operations on struct page then it must change the #if to ensure
> > + * proper alignment of the page struct.
> > + */
> > +#if defined(CONFIG_SLUB)&& defined(CONFIG_CMPXCHG_LOCAL)
> > + __attribute__((__aligned__(2*sizeof(unsigned long))))
> > +#endif

I guess we need a "hey, use __aligned" checkpatch rule.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/