[<prev] [next>] [day] [month] [year] [list]
Message-ID: <168547378404.404.9447142948180425278.tip-bot2@tip-bot2>
Date: Tue, 30 May 2023 19:09:44 -0000
From: "tip-bot2 for Shawn Wang" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Shawn Wang <shawnwang@...ux.alibaba.com>,
"Borislav Petkov (AMD)" <bp@...en8.de>,
Reinette Chatre <reinette.chatre@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/cache] x86/resctrl: Only show tasks' pid in current pid namespace
The following commit has been merged into the x86/cache branch of tip:
Commit-ID: 2997d94b5dd0e8b10076f5e0b6f18410c73e28bd
Gitweb: https://git.kernel.org/tip/2997d94b5dd0e8b10076f5e0b6f18410c73e28bd
Author: Shawn Wang <shawnwang@...ux.alibaba.com>
AuthorDate: Mon, 15 May 2023 14:04:48 +08:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Tue, 30 May 2023 20:57:39 +02:00
x86/resctrl: Only show tasks' pid in current pid namespace
When writing a task id to the "tasks" file in an rdtgroup,
rdtgroup_tasks_write() treats the pid as a number in the current pid
namespace. But when reading the "tasks" file, rdtgroup_tasks_show() shows
the list of global pids from the init namespace, which is confusing and
incorrect.
To be more robust, let the "tasks" file only show pids in the current pid
namespace.
Fixes: e02737d5b826 ("x86/intel_rdt: Add tasks files")
Signed-off-by: Shawn Wang <shawnwang@...ux.alibaba.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Acked-by: Reinette Chatre <reinette.chatre@...el.com>
Acked-by: Fenghua Yu <fenghua.yu@...el.com>
Tested-by: Reinette Chatre <reinette.chatre@...el.com>
Link: https://lore.kernel.org/all/20230116071246.97717-1-shawnwang@linux.alibaba.com/
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 6ad33f3..61cdd9b 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -726,11 +726,15 @@ unlock:
static void show_rdt_tasks(struct rdtgroup *r, struct seq_file *s)
{
struct task_struct *p, *t;
+ pid_t pid;
rcu_read_lock();
for_each_process_thread(p, t) {
- if (is_closid_match(t, r) || is_rmid_match(t, r))
- seq_printf(s, "%d\n", t->pid);
+ if (is_closid_match(t, r) || is_rmid_match(t, r)) {
+ pid = task_pid_vnr(t);
+ if (pid)
+ seq_printf(s, "%d\n", pid);
+ }
}
rcu_read_unlock();
}
Powered by blists - more mailing lists