Linux filesystem development
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Kiryl Shutsemau <kirill@shutemov.name>, akpm@linux-foundation.org
Cc: usama.anjum@arm.com, peterx@redhat.com, liam@infradead.org,
	ljs@kernel.org, vbabka@kernel.org, jannh@google.com,
	pfalcato@suse.de, rppt@kernel.org, surenb@google.com,
	mhocko@suse.com, zenghui.yu@linux.dev, shuah@kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	stable@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH v5 2/2] selftests/mm: add PAGEMAP_SCAN test for THP PMD holes
Date: Thu, 16 Jul 2026 13:25:22 +0200	[thread overview]
Message-ID: <714bdcbb-92cd-4dde-820c-e3761cbbaf07@kernel.org> (raw)
In-Reply-To: <20260715144234.442721-3-kirill@shutemov.name>


> +	/* Fast path: category_mask == return_mask == PAGE_IS_WRITTEN. */
> +	ret = pagemap_ioctl(mem, hpage_size, regions, ARRAY_SIZE(regions), 0, 0,
> +			    PAGE_IS_WRITTEN, 0, 0, PAGE_IS_WRITTEN);
> +	for (i = 0; ret > 0 && i < ret; i++)
> +		fast += LEN(regions[i]);
> +
> +	/* Generic path: same query expressed via category_anyof_mask. */
> +	ret = pagemap_ioctl(mem, hpage_size, regions, ARRAY_SIZE(regions), 0, 0,
> +			    0, PAGE_IS_WRITTEN, 0, PAGE_IS_WRITTEN);
> +	for (i = 0; ret > 0 && i < ret; i++)
> +		slow += LEN(regions[i]);
> +
> +	ksft_test_result(fast == npages && slow == npages,
> +			 "%s pmd-hole reported written by both paths (%ld, %ld of %d)\n",
> +			 __func__, fast, slow, npages);
> +out:
> +	wp_free(mem, hpage_size);
> +	munmap(area, 2 * hpage_size);
> +}

Sorry if I wasn't clear. I think unpopulated_thp_scan_test() can actually reuse
bits of unpopulated_scan_test().

Either by having a magical "use_thp" parameter or by factoring stuff out into a
helper.

Or am I missing an important point why that would not work or be really ugly?

-- 
Cheers,

David

  reply	other threads:[~2026-07-16 11:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 14:42 [PATCH v5 0/2] fs/proc/task_mmu: fix PAGEMAP_SCAN written state for PMD holes Kiryl Shutsemau
2026-07-15 14:42 ` [PATCH v5 1/2] " Kiryl Shutsemau
2026-07-16 11:21   ` David Hildenbrand (Arm)
2026-07-16 12:57   ` Muhammad Usama Anjum
2026-07-15 14:42 ` [PATCH v5 2/2] selftests/mm: add PAGEMAP_SCAN test for THP " Kiryl Shutsemau
2026-07-16 11:25   ` David Hildenbrand (Arm) [this message]
2026-07-16 13:03     ` Kiryl Shutsemau
2026-07-16 14:40       ` David Hildenbrand (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=714bdcbb-92cd-4dde-820c-e3761cbbaf07@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=jannh@google.com \
    --cc=kernel-team@meta.com \
    --cc=kirill@shutemov.name \
    --cc=liam@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=peterx@redhat.com \
    --cc=pfalcato@suse.de \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=usama.anjum@arm.com \
    --cc=vbabka@kernel.org \
    --cc=zenghui.yu@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox