[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200529125959.GB19604@bombadil.infradead.org>
Date: Fri, 29 May 2020 05:59:59 -0700
From: Matthew Wilcox <willy@...radead.org>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [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.
Powered by blists - more mailing lists