From nobody Sun Feb 8 11:21:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 462A7C77B7A for ; Tue, 30 May 2023 19:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233077AbjE3TKB (ORCPT ); Tue, 30 May 2023 15:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233369AbjE3TJu (ORCPT ); Tue, 30 May 2023 15:09:50 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D8CF7; Tue, 30 May 2023 12:09:46 -0700 (PDT) Date: Tue, 30 May 2023 19:09:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685473784; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UBxyMMs76JFCfUryB7BK2Z8JyAjzcmL7jqz+WLRUB0k=; b=eijmGDk9ONkTaPajSZN3plzuLTPCppeURI+6LCtbwNkkANG4tJEzt/blBA2XnbDVG/DYgR aQM7BjIpRmfF+wOg/ZYgFJhrSaFwYrYe+60afF3DhkJ3OVEWW245DFE60KhRf/htVRO0ZR O/BehYYZsD7MTITtI3sHISEG5McCafVymJq3NiiycWuvYQnQYHukKVLTZ/G9FXQQHsoFrP yNt4jDghjRZ3GYZ4TZkIEyvWjVxUU/evzx+2DRX/p0qhM1qSJrND7n7Q7J+xbivSPzWW6X pjaeX4zPm4Y6GWxEaqzL0XTlL0WIJ+HtQpP0rMkYyLhk41SIjJLUpGrP5LR2tQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685473784; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UBxyMMs76JFCfUryB7BK2Z8JyAjzcmL7jqz+WLRUB0k=; b=64715TD/evBFVkDxhOhsG7dzj0XSO52ZRjqOhPZHkHpFG1LPzxO3Y2GYKINuJcLJ9TLogB NVmV07n18IWyxfBQ== From: "tip-bot2 for Shawn Wang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Only show tasks' pid in current pid namespace Cc: Shawn Wang , "Borislav Petkov (AMD)" , Reinette Chatre , Fenghua Yu , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <168547378404.404.9447142948180425278.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/cache branch of tip: Commit-ID: 2997d94b5dd0e8b10076f5e0b6f18410c73e28bd Gitweb: https://git.kernel.org/tip/2997d94b5dd0e8b10076f5e0b6f18410c= 73e28bd Author: Shawn Wang AuthorDate: Mon, 15 May 2023 14:04:48 +08:00 Committer: Borislav Petkov (AMD) 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 Signed-off-by: Borislav Petkov (AMD) Acked-by: Reinette Chatre Acked-by: Fenghua Yu Tested-by: Reinette Chatre Link: https://lore.kernel.org/all/20230116071246.97717-1-shawnwang@linux.al= ibaba.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/r= esctrl/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; =20 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 =3D task_pid_vnr(t); + if (pid) + seq_printf(s, "%d\n", pid); + } } rcu_read_unlock(); }