From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: David Hildenbrand <david@redhat.com>
Cc: Usama Arif <usamaarif642@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, 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,
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,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH 1/5] prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE
Date: Thu, 31 Jul 2025 10:09:08 +0100 [thread overview]
Message-ID: <82f41b2f-fbf1-419c-9ce8-6875929de814@lucifer.local> (raw)
In-Reply-To: <36cae7e8-97d0-4d53-968b-7f39b34fa5c0@redhat.com>
On Thu, Jul 31, 2025 at 10:38:49AM +0200, David Hildenbrand wrote:
> Thanks Lorenzo for the review, I'll leave handling all that to Usama from
> this point :)
>
> On 31.07.25 10:29, Lorenzo Stoakes wrote:
> > Just a ping on the man page stuff - you will do that right? :>)
> >
>
> I'm hoping that Usama can take over that part. If not, I'll handle it (had
> planned it for once it's in mm-stable / going upstream).
>
> [ ... ]
Thanks
>
> > > > > +/*
> > > > > + * Don't disable THPs when explicitly advised (e.g., MADV_HUGEPAGE /
> > > > > + * VM_HUGEPAGE).
> > > > > + */
> > > > > +# define PR_THP_DISABLE_EXCEPT_ADVISED (1 << 1)
> > > >
> > > > NO space after # please.
> > > >
> > >
> > > I think this is following the file convention, the space is there in other flags
> > > all over this file. I dont like the space as well.
> >
> > Yeah yuck. It's not a big deal, but ideally I'd prefer us to be sane even
> > if the rest of the header is less so here.
>
> I'm afraid us doing something different here will not make prctl() any
> better as a whole, so let's keep it consistent in this questionable file.
Sure not a big deal.
>
> >
> > >
> > > > > #define PR_GET_THP_DISABLE 42
> > > > >
> > > > > /*
> > > > > diff --git a/kernel/sys.c b/kernel/sys.c
> > > > > index b153fb345ada..b87d0acaab0b 100644
> > > > > --- a/kernel/sys.c
> > > > > +++ b/kernel/sys.c
> > > > > @@ -2423,6 +2423,50 @@ static int prctl_get_auxv(void __user *addr, unsigned long len)
> > > > > return sizeof(mm->saved_auxv);
> > > > > }
> > > > >
> > > > > +static int prctl_get_thp_disable(unsigned long arg2, unsigned long arg3,
> > > > > + unsigned long arg4, unsigned long arg5)
> > > > > +{
> > > > > + unsigned long *mm_flags = ¤t->mm->flags;
> > > > > +
> > > > > + if (arg2 || arg3 || arg4 || arg5)
> > > > > + return -EINVAL;
> > > > > +
> > > >
> > > > Can we have a comment here about what we're doing below re: the return
> > > > value?
> > > >
> > >
> > > Do you mean add returning 1 for MMF_DISABLE_THP_COMPLETELY and 3 for MMF_DISABLE_THP_EXCEPT_ADVISED?
> >
> > Well more so something about we return essentially flags indicating what is
> > enabled or not, if bit 0 is set then it's disabled, if bit 1 is set then
> > it's that with the exception of VM_HUGEPAGE VMAs.
>
> We have that documented above the defines for flags etc. Maybe simply here:
>
> /* If disabled, we return "1 | flags", otherwise 0. */
Yup I know it was documented, but nice to have here as I'd definitely read this
code and think 'huh?'.
What you suggest is fine!
>
> --
> Cheers,
>
> David / dhildenb
>
Thanks, Lorenzo
next prev parent reply other threads:[~2025-07-31 9:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 16:22 [PATCH 0/5] prctl: extend PR_SET_THP_DISABLE to only provide THPs when advised Usama Arif
2025-07-25 16:22 ` [PATCH 1/5] prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE Usama Arif
2025-07-30 19:31 ` Lorenzo Stoakes
2025-07-30 19:42 ` Usama Arif
2025-07-31 8:29 ` Lorenzo Stoakes
2025-07-31 8:38 ` David Hildenbrand
2025-07-31 9:09 ` Lorenzo Stoakes [this message]
2025-07-31 10:32 ` Usama Arif
2025-07-25 16:22 ` [PATCH 2/5] mm/huge_memory: convert "tva_flags" to "enum tva_type" for thp_vma_allowable_order*() Usama Arif
2025-07-28 13:28 ` David Hildenbrand
2025-07-28 14:09 ` Usama Arif
2025-07-25 16:22 ` [PATCH 3/5] mm/huge_memory: treat MADV_COLLAPSE as an advise with PR_THP_DISABLE_EXCEPT_ADVISED Usama Arif
2025-07-25 16:22 ` [PATCH 4/5] selftests: prctl: introduce tests for disabling THPs completely Usama Arif
2025-07-28 15:06 ` David Hildenbrand
2025-07-29 22:13 ` Usama Arif
2025-07-30 11:39 ` David Hildenbrand
2025-07-25 16:22 ` [PATCH 5/5] selftests: prctl: introduce tests for disabling THPs except for madvise Usama Arif
2025-07-28 16:55 ` SeongJae Park
2025-07-29 22:17 ` Usama Arif
2025-07-31 12:18 [PATCH 0/5] prctl: extend PR_SET_THP_DISABLE to only provide THPs when advised Usama Arif
2025-07-31 12:18 ` [PATCH 1/5] prctl: extend PR_SET_THP_DISABLE to optionally exclude VM_HUGEPAGE 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=82f41b2f-fbf1-419c-9ce8-6875929de814@lucifer.local \
--to=lorenzo.stoakes@oracle.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=david@redhat.com \
--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=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=willy@infradead.org \
--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