From: Lance Yang <lance.yang@linux.dev>
To: David Hildenbrand <david@redhat.com>
Cc: shuah@kernel.org, ioworker0@gmail.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, akpm@linux-foundation.org,
lorenzo.stoakes@oracle.com
Subject: Re: [PATCH v2 1/1] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled
Date: Wed, 17 Sep 2025 21:19:18 +0800 [thread overview]
Message-ID: <706bbb76-1204-4377-aeb8-0c1b21792014@linux.dev> (raw)
In-Reply-To: <ada1b1f9-bd2b-4164-ae8c-80264d4f6dc0@redhat.com>
On 2025/9/17 21:08, David Hildenbrand wrote:
> On 17.09.25 14:27, Lance Yang wrote:
>> From: Lance Yang <lance.yang@linux.dev>
>>
>> The madv_populate and soft-dirty kselftests currently fail on systems
>> where
>> CONFIG_MEM_SOFT_DIRTY is disabled.
>>
>> Introduce a new helper softdirty_supported() into vm_util.c/h to ensure
>> tests are properly skipped when the feature is not enabled.
>>
Oops, I missed "Suggested-by:" here ... will add in v3.
>> Signed-off-by: Lance Yang <lance.yang@linux.dev>
>> ---
>
> [...]
>
>> diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/
>> selftests/mm/vm_util.c
>> index 56e9bd541edd..ac41d10454a5 100644
>> --- a/tools/testing/selftests/mm/vm_util.c
>> +++ b/tools/testing/selftests/mm/vm_util.c
>> @@ -449,6 +449,25 @@ bool check_vmflag_pfnmap(void *addr)
>> return check_vmflag(addr, "pf");
>> }
>> +bool softdirty_supported(void)
>> +{
>> + char *addr;
>> + bool supported = false;
>> + const size_t pagesize = getpagesize();
>> +
>> + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */
>> + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE,
>> + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
>> + if (!addr)
>> + ksft_exit_fail_msg("mmap failed\n");
>> +
>> + if (check_vmflag(addr, "sd"))
>> + supported = true;
>
> Reading the code again, this could just be
>
> supported = check_vmflag(addr, "sd");
Nice. Will do ;)
>
>
> LGTM
>
> Acked-by: David Hildenbrand <david@redhat.com>
Thanks,
Lance
prev parent reply other threads:[~2025-09-17 13:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 12:27 Lance Yang
2025-09-17 13:08 ` David Hildenbrand
2025-09-17 13:19 ` Lance Yang [this message]
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=706bbb76-1204-4377-aeb8-0c1b21792014@linux.dev \
--to=lance.yang@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=shuah@kernel.org \
/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