Re: [PATCH 07/16] x86/mm: Move two more functions from pgtable_64.h to pgtable.h

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

 



On Tue, 16 Jan 2018, Joerg Roedel wrote:

> On Tue, Jan 16, 2018 at 10:03:09AM -0800, Dave Hansen wrote:
> > On 01/16/2018 08:36 AM, Joerg Roedel wrote:
> > > +	return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < KERNEL_PGD_BOUNDARY);
> > > +}
> > 
> > One of the reasons to implement it the other way:
> > 
> > -	return (ptr & ~PAGE_MASK) < (PAGE_SIZE / 2);
> > 
> > is that the compiler can do this all quickly.  KERNEL_PGD_BOUNDARY
> > depends on PAGE_OFFSET which depends on a variable.  IOW, the compiler
> > can't do it.
> > 
> > How much worse is the code that this generates?
> 
> I havn't looked at the actual code this generates, but the
> (PAGE_SIZE / 2) comparison doesn't work on 32 bit where the address
> space is not always evenly split. I'll look into a better way to check
> this.

It should be trivial enough to do

   return (ptr & ~PAGE_MASK) < PGD_SPLIT_SIZE);

and define it PAGE_SIZE/2 for 64bit and for PAE make it depend on the
configured address space split.

Thanks,

	tglx

--
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 OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux