Re: [PATCH] mm: mempolicy: fix automatic numa balancing for shmem

From: Sean Christopherson

Date: Mon Jul 27 2026 - 12:43:51 EST


On Thu, Jul 23, 2026, Gregory Price wrote:
> On Thu, Jul 23, 2026 at 05:15:15PM -0700, Andrew Morton wrote:
> > On Thu, 23 Jul 2026 10:54:06 -0400 Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> >
> > > > But in this case, IIUC, this change will "silently" enable NUMA balancing for
> > > > shmem-based KVM setups where it was previously disabled (albeit unintentionally).
> > > >
> > > > I'm not fundamentally opposed to the change, but I do worry that downstream KVM
> > > > users could be in for a nasty surprise.
> >
> > It is a bit concerning.
> >
> > > This should be very visible in early kernel validation after an
> > > upgrade. VM hosts tend to not do much else, with VM memory dominating
> > > the host. You'd expect a significant uptick in numa_pte_updates,
> > > numa_hint_faults, and a change in per-node nr_shmem stats. And the
> > > patch subject makes it trivial to find in a commit delta scan.
> >
> > Is there anything we can do to make this process less painful?
> > Documentation of course, but what about detecting the situation and
> > emitting a once-off warning?
>
> Maybe a rate-limited or one-time pr_info/warn on the first PROT_NONE
> fault affecting KVM in the painful zap path?
>
> Non-invasive, targeted, and helpful.

Unfortunately, keying off PROT_NONE probably isn't all that targeted and thus
may or may not be helpful, as it would generate what are effectively false
positives for setups where NUMA balacing is already fully enabled. In my
experience, KVM users tend to freak out if there's a "scary" kernel message,
even if everything is working exactly how the admin intended.

Thinking about this more, I'm probably being overly paranoid. The failing KVM
selftest is (very deliberately) about as pathologically stupid as things can get,
i.e. it's not representative of real-world setups.

How about we do nothing for now, and then revisit trying to find a useful way to
alert the end user *if* we start seeing KVM bug reports? As you said earlier, I
think "You turned numa balancing on" is an acceptable answer at this time.