From: "Li Zhe" <lizhe.67@bytedance.com>
To: <mingo@redhat.com>, <peterz@infradead.org>,
<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>,
<dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
<bsegall@google.com>, <mgorman@suse.de>, <vschneid@redhat.com>,
<kprateek.nayak@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <lizhe.67@bytedance.com>
Subject: [PATCH 3/4] proc: Report process NUMA balancing mode
Date: Tue, 8 Sep 2026 20:24:45 +0800 [thread overview]
Message-ID: <20260908122446.56708-4-lizhe.67@bytedance.com> (raw)
In-Reply-To: <20260908122446.56708-1-lizhe.67@bytedance.com>
Add NumaB_mode to /proc/<pid>/status so users can inspect the configured
process automatic NUMA balancing mode without issuing a prctl() from the
target process.
The field reports the process mode as enabled or disabled when automatic
NUMA balancing is supported, and unsupported when the kernel is built
without CONFIG_NUMA_BALANCING. Effective behavior still depends on the
global numa_balancing sysctl and memory policy.
Signed-off-by: Li Zhe <lizhe.67@bytedance.com>
---
fs/proc/array.c | 16 ++++++++++++++++
include/linux/sched/numa_balancing.h | 5 +++++
2 files changed, 21 insertions(+)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index f6f75d206762..a27a6a57e8b2 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -425,6 +425,21 @@ static inline void task_thp_status(struct seq_file *m, struct mm_struct *mm)
seq_printf(m, "THP_enabled:\t%d\n", thp_enabled);
}
+#ifdef CONFIG_NUMA_BALANCING
+static inline void task_numa_balancing_status(struct seq_file *m,
+ struct task_struct *task)
+{
+ seq_printf(m, "NumaB_mode:\t%s\n",
+ task_numa_balancing_mode_name(task));
+}
+#else
+static inline void task_numa_balancing_status(struct seq_file *m,
+ struct task_struct *task)
+{
+ seq_puts(m, "NumaB_mode:\tunsupported\n");
+}
+#endif
+
static inline void task_untag_mask(struct seq_file *m, struct mm_struct *mm)
{
seq_printf(m, "untag_mask:\t%#lx\n", mm_untag_mask(mm));
@@ -453,6 +468,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
task_untag_mask(m, mm);
mmput(mm);
}
+ task_numa_balancing_status(m, task);
task_sig(m, task);
task_cap(m, task);
task_seccomp(m, task);
diff --git a/include/linux/sched/numa_balancing.h b/include/linux/sched/numa_balancing.h
index bc413aae5915..69e79359fa22 100644
--- a/include/linux/sched/numa_balancing.h
+++ b/include/linux/sched/numa_balancing.h
@@ -47,6 +47,11 @@ static inline int task_numa_balancing_get_current(void)
{
return task_numa_process_mode_enabled(current);
}
+
+static inline const char *task_numa_balancing_mode_name(struct task_struct *p)
+{
+ return task_numa_process_mode_enabled(p) ? "enabled" : "disabled";
+}
bool should_numa_migrate_memory(struct task_struct *p, struct folio *folio,
int src_nid, int dst_cpu);
#else
--
2.20.1
next prev parent reply other threads:[~2026-09-08 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 12:24 [PATCH 0/4] sched/numa: Add per-process automatic NUMA balancing control Li Zhe
2026-09-08 12:24 ` [PATCH 1/4] sched/numa: Track per-process automatic NUMA balancing mode Li Zhe
2026-09-08 12:24 ` [PATCH 2/4] sched/numa: Add prctl controls for process mode Li Zhe
2026-09-08 12:24 ` Li Zhe [this message]
2026-09-08 12:24 ` [PATCH 4/4] Documentation: Describe per-process NUMA balancing control Li Zhe
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=20260908122446.56708-4-lizhe.67@bytedance.com \
--to=lizhe.67@bytedance.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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