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] [thread-next>] [day] [month] [year] [list]
Message-Id: <363E4489-76E8-4FD2-AD17-2E0B46160CAB@linux.dev>
Date: Fri, 18 Apr 2025 11:03:59 +0800
From: Muchun Song <muchun.song@...ux.dev>
To: Fan Ni <nifan.cxl@...il.com>
Cc: Sidhartha Kumar <sidhartha.kumar@...cle.com>,
 willy@...radead.org,
 mcgrof@...nel.org,
 a.manzanares@...sung.com,
 dave@...olabs.net,
 akpm@...ux-foundation.org,
 david@...hat.com,
 linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] mm/hugetlb: Refactor __unmap_hugepage_range() to take
 folio instead of page



> On Apr 18, 2025, at 00:34, Fan Ni <nifan.cxl@...il.com> wrote:
> 
> On Thu, Apr 17, 2025 at 12:21:55PM -0400, Sidhartha Kumar wrote:
>> On 4/17/25 11:43 AM, nifan.cxl@...il.com wrote:
>>> From: Fan Ni <fan.ni@...sung.com>
>>> 
>>> The function __unmap_hugepage_range() has two kinds of users:
>>> 1) unmap_hugepage_range(), which passes in the head page of a folio.
>>>    Since unmap_hugepage_range() already takes folio and there are no other
>>>    uses of the folio struct in the function, it is natural for
>>>    __unmap_hugepage_range() to take folio also.
>>> 2) All other uses, which pass in NULL pointer.
>>> 
>>> In both cases, we can pass in folio. Refactor __unmap_hugepage_range() to
>>> take folio.
>>> 
>>> Signed-off-by: Fan Ni <fan.ni@...sung.com>
>>> ---
>>> 
>>> Question: If the change in the patch makes sense, should we try to convert all
>>> "page" uses in __unmap_hugepage_range() to folio?
>>> 
>> 
>> For this to be correct, we have to ensure that the pte in:
>> 
>> 	page = pte_page(pte);
>> 
>> only refers to the pte of a head page. pte comes from:
>> 
>> 	pte = huge_ptep_get(mm, address, ptep);
>> 
>> and in the for loop above:
>> 
>> 	for (; address < end; address += sz)
>> 
>> address is incremented by the huge page size so I think address here only
>> points to head pages of hugetlb folios and it would make sense to convert
>> page to folio here.
>> 
> 
> Thanks Sidhartha for reviewing the series. I have similar understanding and
> wanted to get confirmation from experts in this area.

I think your understanding is right. BTW, you forgot to update definition of
__unmap_hugepage_range() under !CONFIG_HUGETLB_PAGE case.

> 
> Thanks.
> Fan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ