The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nico Pache <nico.pache@linux.dev>
To: Usama Arif <usama.arif@linux.dev>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>, Zi Yan <ziy@nvidia.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	"Liam R. Howlett" <liam@infradead.org>,
	Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
	Kiryl Shutsemau <kas@kernel.org>, Yu Zhao <yuzhao@google.com>,
	Xu Xin <xu.xin@linux.dev>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	Matthew Brost <matthew.brost@intel.com>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	Byungchul Park <byungchul@sk.com>,
	Gregory Price <gourry@gourry.net>,
	Ying Huang <ying.huang@linux.alibaba.com>,
	Alistair Popple <apopple@nvidia.com>,
	Usama Arif <usamaarif642@gmail.com>,
	aarcange@redhat.com
Subject: Re: [PATCH v2 2/2] mm/ksm: prevent zero-page remapping during ksmd-triggered THP splits
Date: Wed, 18 Nov 2026 23:18:44 -0700	[thread overview]
Message-ID: <bd475114-6247-4ab8-b6fe-81724cc320ee@linux.dev> (raw)
In-Reply-To: <20261118212722.3922741-1-usama.arif@linux.dev>



On 11/18/26 2:27 PM, Usama Arif wrote:
> 
> 
> Hey Nico,

Hey Usama!

> 
> I think I have had this conversation either on the previous revision
> or the mailing list somewhere else before, so sorry for restarting this
> again.
> 
> Isnt above a good thing? KSM is a memory saving feature, and this
> is resulting in 1G being freed instantly?

Not necessarily, for two reason (a), we are ignoring the users defined 
pages_to_scan, and (b), this leads to KSM using way more CPU time than 
the user expected, and in our customers cases, a overall system 
regression (outside of KSM also losing some effectiveness).>
> 
> As an alternate to having this patch, should we just have patch 1
> and users should turn off split_underused_thp when using KSM.

Me and David have been discussing the opposite. I was going to drop 
patch 1 as patch 2 solves the underlying issue in a fairly clean manner.

> 
> If you have a large number of THPs on your machine, using KSM is a very
> bad idea IMO due to all the splits that happen.
> IMO, there are 2 optimum host conditions:
> - A large number of THPs, and KSM disabled, hence shrinker can stay on.
> - Very low number of THPs, KSM can be enabled or disabled, but as there
> are a low number of THPs, the shrinker can be turned off.

This requires the user to be aware of these limitations and properly 
configure this system. With this patch we remove the weird interaction 
without needing any config changes. I think in our previous discussion 
David pushed back saying that it is not uncommon to see MADV_MERGEABLE 
and MADV_HUGEPAGE.

I think the approach in patch #2 is the most sound approach.

Let me know if that clears everything up!
Cheers,
-- Nico

> 


      reply	other threads:[~2026-11-19  6:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 17:39 [PATCH v2 0/2] MM: Tighten control over zero-page remapping Nico Pache (Red Hat)
2026-10-25 17:39 ` [PATCH v2 1/2] mm/huge_memory.c: skip zero-page remapping when underused THP shrinker is disabled Nico Pache (Red Hat)
2026-10-25 20:28   ` Barry Song
2026-10-25 21:48     ` Nico Pache
2026-10-26  4:52       ` Barry Song
2026-10-26 20:02         ` Nico Pache
2026-10-26 20:58           ` Barry Song
2026-10-26 21:33             ` Nico Pache
2026-11-16 22:30   ` David Hildenbrand (Arm)
2026-11-16 23:08     ` Nico Pache
2026-11-17 10:00       ` David Hildenbrand (Arm)
2026-11-19  6:09         ` Nico Pache
2026-10-25 17:39 ` [PATCH v2 2/2] mm/ksm: prevent zero-page remapping during ksmd-triggered THP splits Nico Pache (Red Hat)
2026-11-16 22:21   ` David Hildenbrand (Arm)
2026-11-16 23:58     ` Nico Pache
2026-11-17  1:02       ` Xu Xin (vivo)
2026-11-18 21:27   ` Usama Arif
2026-11-19  6:18     ` Nico Pache [this message]

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=bd475114-6247-4ab8-b6fe-81724cc320ee@linux.dev \
    --to=nico.pache@linux.dev \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=byungchul@sk.com \
    --cc=chengming.zhou@linux.dev \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=gourry@gourry.net \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kas@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew.brost@intel.com \
    --cc=ryan.roberts@arm.com \
    --cc=usama.arif@linux.dev \
    --cc=usamaarif642@gmail.com \
    --cc=xu.xin@linux.dev \
    --cc=ying.huang@linux.alibaba.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