From: David Hildenbrand <david@redhat.com>
To: Daniel Gomez <da.gomez@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
"Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org, willy@infradead.org,
linux-mm@kvack.org, Bagas Sanjaya <bagasdotme@gmail.com>,
gost.dev@samsung.com, linux-doc@vger.kernel.org,
Pankaj Raghav <p.raghav@samsung.com>
Subject: Re: [PATCH v3] docs: update THP admin guide about non-tmpfs filesystem support
Date: Fri, 4 Apr 2025 22:01:55 +0200 [thread overview]
Message-ID: <d88270a5-7426-4a6c-b627-83b807e159d0@redhat.com> (raw)
In-Reply-To: <kjmyope67af54eagiatlgph7bo4lgzy6jyut7z6elzartkoogy@eon2qkiwdbab>
On 04.04.25 21:44, Daniel Gomez wrote:
> On Fri, Apr 04, 2025 at 09:07:23PM +0100, David Hildenbrand wrote:
>> On 04.04.25 19:58, Luis Chamberlain wrote:
>>> On Fri, Apr 04, 2025 at 06:18:12PM +0200, David Hildenbrand wrote:
>>>> On 04.04.25 17:32, Luis Chamberlain wrote:
>>>>> On Fri, Apr 04, 2025 at 04:06:57PM +0200, Pankaj Raghav (Samsung) wrote:
>>>>>> From: Pankaj Raghav <p.raghav@samsung.com>
>>>>>>
>>>>>> THP support for non-tmpfs filesystem has been around for some time now.
>>>>>> Update the admin guide to reflect it.
>>>>>>
>>>>>> While we are at it, move FilePmdMapped to previous paragraph for clarity,
>>>>>> and clarify ShmemPmdMapped & ShmemHugePage.
>>>>>>
>>>>>> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
>>>>>> Acked-by: David Hildenbrand <david@redhat.com>
>>>>>> ---
>>>>>>
>>>>>> Changes since v2:
>>>>>> - Address comment from Bagas Sanjaya
>>>>>> - Squash commits and Ack from David
>>>>>>
>>>>>> Documentation/admin-guide/mm/transhuge.rst | 22 +++++++++++++++-------
>>>>>> 1 file changed, 15 insertions(+), 7 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
>>>>>> index dff8d5985f0f..f8aae64e38d0 100644
>>>>>> --- a/Documentation/admin-guide/mm/transhuge.rst
>>>>>> +++ b/Documentation/admin-guide/mm/transhuge.rst
>>>>>> @@ -12,8 +12,8 @@ using huge pages for the backing of virtual memory with huge pages
>>>>>> that supports the automatic promotion and demotion of page sizes and
>>>>>> without the shortcomings of hugetlbfs.
>>>>>> -Currently THP only works for anonymous memory mappings and tmpfs/shmem.
>>>>>> -But in the future it can expand to other filesystems.
>>>>>> +Currently, THP only works for anonymous memory mappings, tmpfs/shmem and
>>>>>> +filesystems that support large folios.
>>>>>
>>>>> That seems to allude that THP can be supported on filesystems
>>>>> that suppor large folios. I don't think we want to call that THP
>>>>> and that can confuse folks. Leaving "currently" also seems to
>>>>> indicate that there is more work to be done for THP for filesystems
>>>>> but that's not true as well. So how about something like:
>>>>>
>>>>> THP only works for anonymous memory mappings, and the tmpfs/shmem is the only
>>>>> filesystem to support it. The alternative to THP for other filesystems is to
>>>>> support large folios and with it you can end up using huge pages
>>>>
>>>> That makes things more complicated without a good reason.
>>>>
>>>> See CONFIG_READ_ONLY_THP_FOR_FS as an early usage of the term "THP" for
>>>> stuff we have in the pagecache.
>>>
>>> OK.
>>>
>>>> (with large folios we now properly implement
>>>> this concept, and support more than only PMD size)
>>>
>>> Do we really want to call large folio support on filesystems THP?
>>
>> Good question.
>>
>> "folio" is just the metadata we currently use to manage a chunk of memory,
>> and a "large folio" is one that spans more than a single page -- huge page,
>> large page, super page, ... in the past the metadata for that used to be a
>> complicated piece of "compound page". In the future, we might call it
>> differently (struct file_mem ?), who knows.
>>
>> So "large folio" support in a fs allows for the usage of these larger chunks
>> of memory (huge pages).
>
> I'm a bit confused here. I thought the term 'huge pages' referred to specific
> page table level like PMD, PUD, or PGD (and not PTE). And "large folio" term can
> span up to anything (currently up to PMD). Could you clarify if I'm
> misunderstanding something?
The transhuge.rst is still a bit inconsistent and confusing, but we
started generalizing the concept to special-case "Traditional THPs" to
be PMD-sized THPs. See the description about mTHP in the document.
If a small folio represents a single page, then a large folio represents
multiple pages (large/huge/super page). But again, "folio" is the
metadata we use to manage this chunk of memory. Just like we didn't call
a "huge page" a "compound page" back in the days; the "compound page"
was a way to manage the metadata assigned to a "larger chunk of memory
covering multiple base pages" as one unit.
I once had a longer writeup about all that (including how hugetlb
supports different huge page sizes, how freebsd calls these thing super
pages etc).
This topic seems to pop every 6 months, likely we really should do a
better job at documenting all that.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-04-04 20:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 14:06 Pankaj Raghav (Samsung)
2025-04-04 15:32 ` Luis Chamberlain
2025-04-04 16:18 ` David Hildenbrand
2025-04-04 17:58 ` Luis Chamberlain
2025-04-04 19:07 ` David Hildenbrand
2025-04-04 19:44 ` Daniel Gomez
2025-04-04 20:01 ` David Hildenbrand [this message]
2025-04-04 16:31 ` Pankaj Raghav (Samsung)
2025-04-04 18:02 ` Luis Chamberlain
2025-04-10 9:31 ` Daniel Gomez
2025-04-04 19:16 ` David Hildenbrand
2025-04-08 9:44 ` Pankaj Raghav (Samsung)
2025-04-04 23:55 ` Bagas Sanjaya
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=d88270a5-7426-4a6c-b627-83b807e159d0@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bagasdotme@gmail.com \
--cc=corbet@lwn.net \
--cc=da.gomez@kernel.org \
--cc=gost.dev@samsung.com \
--cc=kernel@pankajraghav.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=p.raghav@samsung.com \
--cc=willy@infradead.org \
/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