Re: [PATCH 2/7] mm: Move pt_mm within struct page

From: Matthew Wilcox
Date: Wed Apr 29 2020 - 08:53:47 EST


On Wed, Apr 29, 2020 at 09:34:02AM +0200, Geert Uytterhoeven wrote:
> > +++ b/include/linux/mm_types.h
> > @@ -149,11 +149,8 @@ struct page {
> > pgtable_t pmd_huge_pte;
> > };
> > };
> > - unsigned long _pt_pad_2; /* mapping */
> > - union {
> > - struct mm_struct *pt_mm; /* x86 pgds only */
> > - atomic_t pt_frag_refcount; /* powerpc */
> > - };
> > + struct mm_struct *pt_mm;
> > + atomic_t pt_frag_refcount; /* powerpc */
>
> So here is now an implicit hole on 64-bit platforms, right?
> Do we have any where alignof(long) != 8?

There's an implicit hole if someone's turned on spinlock debugging and
has split pagetable locks. Without the need to allocate the spinlock
separately, the ptl will actually move from the same word as 'private'
to the same word as 'index', freeing up 'private' entirely. I don't
intend to depend on that, but it's not quite as critical to line up the
various members of struct page as it used to be.