[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f3c0853d-0b26-49ef-82b2-df1f5163dd4b@linux.alibaba.com>
Date: Tue, 24 Jun 2025 09:52:50 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: David Hildenbrand <david@...hat.com>, akpm@...ux-foundation.org,
hughd@...gle.com
Cc: ziy@...dia.com, lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com,
npache@...hat.com, ryan.roberts@....com, dev.jain@....com,
baohua@...nel.org, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] mm: shmem: disallow hugepages if the system-wide
shmem THP sysfs settings are disabled
On 2025/6/23 21:59, David Hildenbrand wrote:
> On 23.06.25 10:28, Baolin Wang wrote:
>> When invoking thp_vma_allowable_orders(), if the TVA_ENFORCE_SYSFS
>> flag is not
>> specified, we will ignore the THP sysfs settings. And the
>> MADV_COLLAPSE is an
>> example of such a case.
>>
>> The MADV_COLLAPSE will ignore the system-wide shmem THP sysfs
>> settings, which
>> means that even though we have disabled the shmem THP configuration,
>> MADV_COLLAPSE
>> will still attempt to collapse into a shmem THP. This violates the
>> rule we have
>> agreed upon: never means never.
>>
>> Another rule for madvise, referring to David's suggestion: “allowing
>> for collapsing
>> in a VM without VM_HUGEPAGE in the "madvise" mode would be fine".
>>
>> To fix the MADV_COLLAPSE issue for shmem, then the current strategy
>> should be:
>>
>> For shmem, if none of always, madvise, within_size, and inherit have
>> enabled
>> PMD-sized THP, then MADV_COLLAPSE will be prohibited from collapsing
>> PMD-sized THP.
>
> I assume we could rephrase that to "For shmem, if "shmem_enabled" is set
> to either "none" or "deny", then MADV_COLLAPSE will be prohibited from
> collapsing."
Yes. Setting 'deny' will also prevent MADV_COLLAPSE(), and there is no
'none' option for 'shmem_enabled'. Will update the commit mesasge to
make it clear.
Powered by blists - more mailing lists