Re: [PATCH 1/4] selftests/mm: open pagemap and kpageflags once for check_huge()

From: David Hildenbrand (Arm)

Date: Thu Oct 01 2026 - 07:43:15 EST


On 9/29/26 17:28, Zi Yan wrote:
> On 29 Sep 2026, at 9:15, Kiryl Shutsemau wrote:
>
>> From: "Kiryl Shutsemau (Meta)" <kas@xxxxxxxxxx>
>>
>> check_huge_anon() and check_huge_file() open /proc/self/pagemap and
>> /proc/kpageflags on every call and read the PMD size from sysfs on top.
>> The khugepaged test calls them hundreds of times.
>>
>> Open both once and keep the descriptors. A pagemap descriptor is tied
>> to the mm of the process that opened it, and the khugepaged fork() cases
>> call check_huge() from the child, so reopen it when getpid() changes.
>>
>> Cache the PMD size in read_pmd_pagesize() as well.
>
> This part might be overlapping with Yeoreum’s another series[1].
>
> [1] https://lore.kernel.org/all/20260921-fix_hpage_macro-v4-2-cdea4fc6ce3f@xxxxxxx/

Yes, let's provide feedback there instead.

--
Cheers,

David