Re: [PATCH v3 RESEND 2/2] x86/mm/KASLR: Fix the size of vmemmap section

From: Kirill A. Shutemov
Date: Mon Apr 29 2019 - 09:16:17 EST


On Mon, Apr 29, 2019 at 04:12:46PM +0800, Baoquan He wrote:
> > > + * Calculate how many TB vmemmap region needs, and aligned to
> > > + * 1TB boundary.
> > > + */
> > > + vmemmap_size = (kaslr_regions[0].size_tb << (TB_SHIFT - PAGE_SHIFT)) *
> > > + sizeof(struct page);
> >
> > Hm. Don't we need to take into account alignment requirements for struct
> > page here? I'm worried about some exotic debug kernel config where
> > sizeof(struct page) doesn't satify __alignof__(struct page).
>
> I know sizeof(struct page) has handled its own struct alignment and
> padding.

I didn't realize that. Sorry for the noise.

Acked-by: Kirill A. Shutemov <kirill@xxxxxxxxxxxxxxx>

--
Kirill A. Shutemov