[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <85a85f3d-8c3e-4159-b186-d1f9f0c5530d@gmail.com>
Date: Thu, 31 Jul 2025 11:32:16 +0100
From: Usama Arif <usamaarif642@...il.com>
To: David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, corbet@....net, rppt@...nel.org,
surenb@...gle.com, mhocko@...e.com, hannes@...xchg.org, baohua@...nel.org,
shakeel.butt@...ux.dev, riel@...riel.com, ziy@...dia.com,
laoar.shao@...il.com, dev.jain@....com, baolin.wang@...ux.alibaba.com,
npache@...hat.com, Liam.Howlett@...cle.com, ryan.roberts@....com,
vbabka@...e.cz, jannh@...gle.com, Arnd Bergmann <arnd@...db.de>,
sj@...nel.org, linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
kernel-team@...a.com, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH 1/5] prctl: extend PR_SET_THP_DISABLE to optionally
exclude VM_HUGEPAGE
On 31/07/2025 09:38, 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).
Yes, plan to take care of man page, systemd, etc once the patch makes it to mm-stable.
>
> [ ... ]
>
>>>>> +/*
>>>>> + * 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.
>
>>
>>>
>>>>> #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. */
>
Thanks, will add this to next revision.
Powered by blists - more mailing lists