lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZJG6eDZNZFf4Xs7a@x1n>
Date:   Tue, 20 Jun 2023 10:40:56 -0400
From:   Peter Xu <peterx@...hat.com>
To:     David Hildenbrand <david@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Matthew Wilcox <willy@...radead.org>,
        Andrea Arcangeli <aarcange@...hat.com>,
        John Hubbard <jhubbard@...dia.com>,
        Mike Rapoport <rppt@...nel.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        James Houghton <jthoughton@...gle.com>,
        Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH 3/7] mm/hugetlb: Add page_mask for
 hugetlb_follow_page_mask()

On Tue, Jun 20, 2023 at 09:01:23AM +0200, David Hildenbrand wrote:
> On 19.06.23 23:43, Peter Xu wrote:
> > On Tue, Jun 13, 2023 at 05:53:42PM -0400, Peter Xu wrote:
> > > @@ -6506,6 +6507,7 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma,
> > >   		 * because we hold the ptl lock and have verified pte_present().
> > >   		 */
> > >   		WARN_ON_ONCE(try_grab_page(page, flags));
> > > +		*page_mask = huge_page_mask(h);
> > 
> > Sorry, I was wrong this line.  It should be:
> > 
> > 		*page_mask = ~huge_page_mask(h) >> PAGE_SHIFT;
> > 
> 
> That's ... surprising. It feels like either page_mask or huge_page_mask()
> has a misleading name ....
> 
> h->mask = ~(huge_page_size(h) - 1);
> 
> 
> For PMDs, we do
> 
> ctx->page_mask = HPAGE_PMD_NR - 1;
> 
> 
> Maybe
> 
> *page_mask = PHYS_PFN(huge_page_size(h)) - 1;
> 
> Would be clearer.

Since I just posted a new version.. I'll see whether I should get that
cleaned up in a new one.

> 
> I guess "page_mask" should actually be "pfn_mask" ... but the meaning
> regarding PAGE_MASK are still inverted ...

Yes, pfn_mask can be at least slightly better.  I can add a patch to rename
it, or we can also do it on top as cleanups.

Thanks,

-- 
Peter Xu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ