From: David Hildenbrand <david@redhat.com>
To: Usama Arif <usamaarif642@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Cc: linux-fsdevel@vger.kernel.org, corbet@lwn.net, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, hannes@cmpxchg.org,
baohua@kernel.org, shakeel.butt@linux.dev, riel@surriel.com,
ziy@nvidia.com, laoar.shao@gmail.com, dev.jain@arm.com,
baolin.wang@linux.alibaba.com, npache@redhat.com,
lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
ryan.roberts@arm.com, vbabka@suse.cz, jannh@google.com,
Arnd Bergmann <arnd@arndb.de>,
sj@kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH v2 4/5] selftests: prctl: introduce tests for disabling THPs completely
Date: Fri, 1 Aug 2025 14:53:16 +0200 [thread overview]
Message-ID: <8ba84519-7e69-4058-9ac1-d3e2e622a6ab@redhat.com> (raw)
In-Reply-To: <22e263a3-a1d2-4159-b3c8-44f7a29bace9@gmail.com>
>>> +
>>> +struct test_results {
>>> + int prctl_get_thp_disable;
>>
>> The result is always one, does that here make sense?
>
> Its 3 in the next patch for PR_THP_DISABLE_EXCEPT_ADVISED :)
>
> I will remove this struct, but I think maybe it might have been a good idea to squash this
> with the next patch to show why the struct was useful.
I think it's reasonable to keep them separate.
>
>>
>>> + int prctl_applied_collapse_none;
>>
>> "prctl_applied" is a bit confusing. And most of these always have the same value.
>>
>> Can't we special case the remaining two cases on the current policy and avoid this struct compeltely?
>>
>
> The values are different in the next patch when PR_THP_DISABLE_EXCEPT_ADVISED is used.
>
> Just to explain how I came about using this struct test_results (though it doesnt matter as
> I will remove it for the next revision):
> I wanted to maximise code reuse and only wanted to have one instance of prctl_thp_disable_test.
> I actually started with special casing, but went the brute force way of adding too many if else
> statements and it was looking quite messy after I added the tests for PR_THP_DISABLE_EXCEPT_ADVISED.
> I saw this struct test_results in another kselftest and thought this should make it much better and
> extendable.
>
> I have removed struct test_results and changed prctl_thp_disable_test to the following for next revision:
Yeah, or just duplicate that function and call it
prctl_thp_disable_unless_advised_test() in the next patch.
Makes the code easier to read and the duplication is limited.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-08-01 12:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-31 12:27 [PATCH v2 0/5] prctl: extend PR_SET_THP_DISABLE to only provide THPs when advised Usama Arif
2025-07-31 12:27 ` [PATCH v2 1/5] prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE Usama Arif
2025-07-31 12:40 ` Lorenzo Stoakes
2025-07-31 13:12 ` Usama Arif
2025-07-31 13:18 ` Lorenzo Stoakes
2025-07-31 13:20 ` David Hildenbrand
2025-07-31 15:13 ` Zi Yan
2025-07-31 12:27 ` [PATCH v2 2/5] mm/huge_memory: convert "tva_flags" to "enum tva_type" for thp_vma_allowable_order*() Usama Arif
2025-07-31 14:00 ` Lorenzo Stoakes
2025-07-31 15:19 ` Zi Yan
2025-07-31 16:15 ` David Hildenbrand
2025-08-01 10:08 ` Lorenzo Stoakes
2025-07-31 19:20 ` Usama Arif
2025-08-01 10:12 ` Lorenzo Stoakes
2025-07-31 12:27 ` [PATCH v2 3/5] mm/huge_memory: treat MADV_COLLAPSE as an advise with PR_THP_DISABLE_EXCEPT_ADVISED Usama Arif
2025-07-31 14:38 ` Lorenzo Stoakes
2025-07-31 14:54 ` David Hildenbrand
2025-08-01 10:32 ` Lorenzo Stoakes
2025-08-01 11:26 ` Usama Arif
2025-07-31 12:27 ` [PATCH v2 4/5] selftests: prctl: introduce tests for disabling THPs completely Usama Arif
2025-07-31 19:42 ` David Hildenbrand
2025-08-01 11:42 ` Usama Arif
2025-08-01 12:53 ` David Hildenbrand [this message]
2025-07-31 12:27 ` [PATCH v2 5/5] selftests: prctl: introduce tests for disabling THPs except for madvise Usama Arif
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=8ba84519-7e69-4058-9ac1-d3e2e622a6ab@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=corbet@lwn.net \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=jannh@google.com \
--cc=kernel-team@meta.com \
--cc=laoar.shao@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=npache@redhat.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=sj@kernel.org \
--cc=surenb@google.com \
--cc=usamaarif642@gmail.com \
--cc=vbabka@suse.cz \
--cc=ziy@nvidia.com \
/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;
as well as URLs for NNTP newsgroup(s).