[lkml]   [2020]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v4 06/36] mm: Introduce offset_in_thp
On Fri, May 22, 2020 at 08:15:17PM +0300, Kirill A. Shutemov wrote:
> On Fri, May 15, 2020 at 06:16:26AM -0700, Matthew Wilcox wrote:
> > +#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1))
> Looks like thp_mask() would be handy here.

It's not the only place we could use a thp_mask(), but PAGE_MASK is the
inverse of what I think it should be:

include/asm-generic/page.h:#define PAGE_MASK (~(PAGE_SIZE-1))

ie addr & PAGE_MASK returns the address aligned to page size, not the
offset within the page. Given this ambiguity, I'm inclined to leave
it as (thp_size(page) - 1), as it's clear which bits we're masking off.

 \ /
  Last update: 2020-05-29 15:00    [W:0.087 / U:0.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site