Re: [v3 PATCH 1/1] fs/proc: Expose mm_cpumask in /proc/[pid]/status

From: Peter Zijlstra

Date: Thu Jan 15 2026 - 16:24:21 EST


On Thu, Jan 15, 2026 at 10:19:08PM +0100, David Hildenbrand (Red Hat) wrote:
> On 1/15/26 21:54, Aaron Tomlin wrote:
> > This patch introduces two new fields to /proc/[pid]/status to display the
> > set of CPUs, representing the CPU affinity of the process's active
> > memory context, in both mask and list format: "Cpus_active_mm" and
> > "Cpus_active_mm_list". The mm_cpumask is primarily used for TLB and
> > cache synchronisation.
> >
> > Exposing this information allows userspace to easily describe the
> > relationship between CPUs where a memory descriptor is "active" and the
> > CPUs where the thread is allowed to execute. The primary intent is to
> > provide visibility into the "memory footprint" across CPUs, which is
> > invaluable for debugging performance issues related to IPI storms and
> > TLB shootdowns in large-scale NUMA systems. The CPU-affinity sets the
> > boundary; the mm_cpumask records the arrival; they complement each
> > other.
> >
> > Frequent mm_cpumask changes may indicate instability in placement
> > policies or excessive task migration overhead.
> >
> > These fields are exposed only on architectures that explicitly opt-in
> > via CONFIG_ARCH_WANT_PROC_CPUS_ACTIVE_MM. This is necessary because
> > mm_cpumask semantics vary significantly across architectures; some
> > (e.g., x86) actively maintain the mask for coherency, while others may
> > never clear bits, rendering the data misleading for this specific use
> > case. x86 is updated to select this feature by default.
> >
> > The implementation reads the mask directly without introducing additional
> > locks or snapshots. While this implies that the hex mask and list format
> > could theoretically observe slightly different states on a rapidly
> > changing system, this "best-effort" approach aligns with the standard
> > design philosophy of /proc and avoids imposing locking overhead on
> > critical memory management paths.
>
>
> Yes, restricting to architectures that have the expected semantics is
> better.
>
> ... but we better get the blessing from x86 folks :)
>
> (CCing the x86 MM folks)

Yeah, seems like a very bad idea this. mm_cpumask really is an arch
detail you cannot rely on very much. Exposing this to userspace is
terrible.