From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Nico Pache <npache@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
yuzhao@google.com, usamaarif642@gmail.com, lance.yang@linux.dev,
baohua@kernel.org, dev.jain@arm.com, ryan.roberts@arm.com,
liam@infradead.org, baolin.wang@linux.alibaba.com,
ziy@nvidia.com, ljs@kernel.org, akpm@linux-foundation.org
Subject: Re: [RFC] mm: restrict zero-page remapping to underused THP splits
Date: Tue, 12 May 2026 21:02:38 +0200 [thread overview]
Message-ID: <f2f218fe-a14b-4714-9893-465a4edb4570@kernel.org> (raw)
In-Reply-To: <CAA1CXcCkd7HWH6MpLQ+EeHzjJ9D=+=CdX2OsQAb8MMWMn=Rx2Q@mail.gmail.com>
On 5/12/26 20:36, Nico Pache wrote:
> On Tue, May 12, 2026 at 1:05 AM David Hildenbrand (Arm)
> <david@kernel.org> wrote:
>>
>> On 5/11/26 20:40, Nico Pache wrote:
>>>
>>> And what was the expected behavior before this commit? Did we just
>>> deal with the wasted memory?
>>
>> Before your change, splitting will always free memory, no matter who triggers
>> splitting. So there is no wasted memory (regarding underused THPs).
>>
>> With your change, if we happen to split before the deferred shrinker runs, we
>> end up with zero-filled pages that waste memory. And reclaiming them (through
>> the deferred shrinker) first requires another re-collapse to a THP.
>>
>> Or am I misunderstanding your question?
>
> I meant before b1f202060afe ("mm: remap unused subpages to shared
> zeropage when splitting isolated thp"). Sorry, I should have been more
> specific.
>
> As in before the underutilized shrinker (and commit b1f202060afe), we
> had the exact problem you describe above and no way to handle it.
> Correct?
Right. That's why the underused shrinker was added, to directly free pages that
have been over-allocated with a THP, but are actually never "used" (remain zero).
>
> I guess at reclaim THPs would be split and we would swap out a zero filled page?
We don't necessarily split during swapout, we try to swap out the THP if
supported. But yes, that can happen.
I'm more thinking about other reasons to split a THP (e.g., migration, partial
MADV_PAGEOUT/MADV_COLD/MADV_FREE), where the behavior would be changed.
--
Cheers,
David
next prev parent reply other threads:[~2026-05-12 19:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 17:05 [RFC] mm: restrict zero-page remapping to underused THP splits Nico Pache
2026-05-08 21:32 ` David Hildenbrand (Arm)
2026-05-09 8:25 ` Lance Yang
2026-05-10 11:39 ` Usama Arif
2026-05-11 6:36 ` David Hildenbrand (Arm)
2026-05-11 13:10 ` Usama Arif
2026-05-11 13:42 ` David Hildenbrand (Arm)
2026-05-11 13:44 ` David Hildenbrand (Arm)
2026-05-11 14:15 ` Usama Arif
2026-05-11 18:40 ` Nico Pache
2026-05-12 7:05 ` David Hildenbrand (Arm)
2026-05-12 18:36 ` Nico Pache
2026-05-12 19:02 ` David Hildenbrand (Arm) [this message]
2026-05-09 3:21 ` Lance Yang
2026-05-11 18:42 ` Nico Pache
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=f2f218fe-a14b-4714-9893-465a4edb4570@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=npache@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=usamaarif642@gmail.com \
--cc=yuzhao@google.com \
--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