Re: [PATCH] x86/mm: fix regression with huge pages on PAE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:

> On Thu, Nov 12, 2015 at 08:48:54AM +0100, Ingo Molnar wrote:
> > 
> > * Borislav Petkov <bp@xxxxxxxxx> wrote:
> > 
> > > --- a/arch/x86/include/asm/pgtable_types.h
> > > +++ b/arch/x86/include/asm/pgtable_types.h
> > > @@ -279,17 +279,14 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
> > >  static inline pudval_t pud_pfn_mask(pud_t pud)
> > >  {
> > >  	if (native_pud_val(pud) & _PAGE_PSE)
> > > -		return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK;
> > > +		return ~((1ULL << PUD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
> > >  	else
> > >  		return PTE_PFN_MASK;
> > >  }
> > 
> > >  static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
> > >  {
> > >  	if (native_pmd_val(pmd) & _PAGE_PSE)
> > > -		return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK;
> > > +		return ~((1ULL << PMD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
> > >  	else
> > >  		return PTE_PFN_MASK;
> > >  }
> > 
> > So instead of uglifying the code, why not fix the real bug: change the 
> > PMD_PAGE_MASK/PUD_PAGE_MASK definitions to be 64-bit everywhere?
> 
> *PAGE_MASK are usually applied to virtual addresses. I don't think it
> should anything but 'unsigned long'. This is odd use case really.

So we already have PHYSICAL_PAGE_MASK, why not introduce PHYSICAL_PMD_MASK et al, 
instead of uglifying the code?

But, what problems do you expect with having a wider mask than its primary usage? 
If it's used for 32-bit values it will be truncated down safely. (But I have not 
tested it, so I might be missing some complication.)

Thanks,

	Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]