Re: [PATCH 3/7] mm/hugetlb: Add page_mask for hugetlb_follow_page_mask()

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

 



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.

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

--
Cheers,

David / dhildenb





[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