[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <003c12a7-cb3b-4bbd-86ac-4caaddcabf26@gmail.com>
Date: Wed, 23 Jul 2025 18:07:48 +0100
From: Usama Arif <usamaarif642@...il.com>
To: David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-doc@...r.kernel.org, Jonathan Corbet <corbet@....net>,
Andrew Morton <akpm@...ux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>, Nico Pache <npache@...hat.com>,
Ryan Roberts <ryan.roberts@....com>, Dev Jain <dev.jain@....com>,
Barry Song <baohua@...nel.org>, Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>, Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>, SeongJae Park <sj@...nel.org>,
Jann Horn <jannh@...gle.com>, Yafang Shao <laoar.shao@...il.com>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH POC] prctl: extend PR_SET_THP_DISABLE to optionally
exclude VM_HUGEPAGE
>> Thanks for the patch David!
>>
>> As discussed in the other thread, with the below diff
>>
>> diff --git a/kernel/sys.c b/kernel/sys.c
>> index 2a34b2f70890..3912f5b6a02d 100644
>> --- a/kernel/sys.c
>> +++ b/kernel/sys.c
>> @@ -2447,7 +2447,7 @@ static int prctl_set_thp_disable(unsigned long thp_disable, unsigned long flags,
>> return -EINVAL;
>> /* Flags are only allowed when disabling. */
>> - if (!thp_disable || (flags & ~PR_THP_DISABLE_EXCEPT_ADVISED))
>> + if ((!thp_disable && flags) || (flags & ~PR_THP_DISABLE_EXCEPT_ADVISED))
>> return -EINVAL;
>> if (mmap_write_lock_killable(current->mm))
>> return -EINTR;
>>
>>
>> I tested with the below selftest, and it works. It hopefully covers
>> majority of the cases including fork and re-enabling THPs.
>> Let me know if it looks ok and please feel free to add this in the
>> next revision you send.
>>
>>
>> Once the above diff is included, please feel free to add
>>
>> Acked-by: Usama Arif <usamaarif642@...il.com>
>> Tested-by: Usama Arif <usamaarif642@...il.com>
>
> Thanks!
>
> The latest version lives at
>
> https://github.com/davidhildenbrand/linux/tree/PR_SET_THP_DISABLE
>
> With all current review feedback addressed (primarily around description+comments) + that one fix.
>
>
Hi David,
Just wanted to check if the above branch is up to date?
I didn't check the description/comments, but it still has [1]:
if (!thp_disable || (flags & ~PR_THP_DISABLE_EXCEPT_ADVISED))
and not
if ((!thp_disable && flags) || (flags & ~PR_THP_DISABLE_EXCEPT_ADVISED))
in prctl_set_thp_disable, which is causing the reset to system policy case in my selftest to fail.
[1] https://github.com/davidhildenbrand/linux/commit/5711cdf5dfe65ca28dac2a57d62e18f1475dac57#diff-dc9985831020a20a54baf023fec641593d0d4e75a78988c3b35a176aff1c0321R2450
Thanks,
Usama
Powered by blists - more mailing lists