On 01/16/2018 08:36 AM, Joerg Roedel wrote: > +/* > + * Page table pages are page-aligned. The lower half of the top > + * level is used for userspace and the top half for the kernel. > + * > + * Returns true for parts of the PGD that map userspace and > + * false for the parts that map the kernel. > + */ > +static inline bool pgdp_maps_userspace(void *__ptr) > +{ > + unsigned long ptr = (unsigned long)__ptr; > + > + 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? -- 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>