From nobody Wed Feb 5 19:10:27 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 441D41DD0C7 for ; Thu, 16 Jan 2025 09:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737021422; cv=none; b=mk4wk6IAqt8NuHx/HKWBLvZ+VHzFtAcLOBLAAdhryfejQfBgS+wQySxNlQ5YDoUFoCXJ8gZ3dVHz2b/AdHaED0KmhZKniJ4uGwlnHHtC1Ul/BPxcRn2Cdv+k+JyUHilmYT+Y57I5ippuWPfGpfzpr1Ozihj2wUBarZE00HsQYPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737021422; c=relaxed/simple; bh=EAjIHYsQHu5Qztu+FJQE8Aask+V9lOoZp97lcTQQ054=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=V/OY+0gFO/PWOdfwwXEa8vvT00Xbp7Kgz/7Z2taGvpmlNFj1Npl8NBQkLd+0M6JqZG+jCx5r83q+62JNCeMV58RWqnYPV34zh+OEgjiWmYxfz+oHRi5Q4d03qY6p/43bv3K0YzBLkcCPKb5KU2LoP5g4uy2MBYHkz/XyHwI/PVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=dtLNTTH2; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dtLNTTH2" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-385d7b4da2bso644765f8f.1 for ; Thu, 16 Jan 2025 01:57:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737021418; x=1737626218; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KjN+BTd6HGuSA9k3Pw827ZjXdUPZek7uz38VNrIqxDY=; b=dtLNTTH2eDhHecFqG59cMtKsAHKaclNPeFUZIQvjjQn8A4heTvtF+g3NwJnRYVhRnx Hdb7wR7T4GuNIUGoFGjHseztMFIRpSFGN5+nfh21CYUWT8LtY58rRcZ9S1IqI7E6Xxmd Gdi1ETePdgNhkmcmxyTzbIFLX0NY99n7RhJywha4icRVsbAyuVrPDuIhGQOd9soSFDy6 YNqBVMbuOsEAMLmQpr/SfmtJxD9LseAa0PgMDW27SXnRUUxv4FjankeGXNJfmN/qJuXO G3YNlB87nZhI3uqhAi7IfGjwomZFtlkDpUNjtvLzJ9coXPwRtQfMYsONQ8cyPmWsIFgM cv1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737021418; x=1737626218; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KjN+BTd6HGuSA9k3Pw827ZjXdUPZek7uz38VNrIqxDY=; b=UwRITygS6JQh2nZBgnYggHdFdgJqyWSL/HZ02/VEWmf8Vxk64rbSYmx/n0GHjI3jOa bvzto+n+5tQAWAl6m0u0z+aiyoDEvOawLAkiBFrHWFgX+QDYwYbFQAJD8Pn/xkGYnlv/ frXJ6uyQbsLRVeSao9hWmxuLfBfbXaoF/Y3Urg2lkxU0HO4j4oUGIukqYJao6jhGg81k lLWMGraasokEIcTgVwiuM3j7qw+Sh4uUyoLXyhiwEw+tYtE4+5hBPInUOLfkOYicPwOG JCcy3CTU5xkiW11iPpwBrYGa9itq+eAncSh0b3V1fns6/oOOodaocmswN29wFwZdDT+y BBEg== X-Gm-Message-State: AOJu0YwMfdteSUZJ6VdDadPiizzIpAVPW9o9ByLlk6MnOCTxsxTFUuEP xD8uXpOJt7Vx7c4T+LEbp15+31dIIzTDXp6oWZf/8SasCHOEBbKWqB1kjFCTOJjeEUR0hQJh7bN d X-Gm-Gg: ASbGnct45k54Qtyj5SRVp6WbK54SMm3SWe0mxCUxMXzx0zWkKlqXdZpzyvJT3/xj8My ZAkDEO2jT1d3DgbZ3LQ2wmz3ZOwF9yJ8+5TeGO/kFNbedGDBswLX85U+Uqzlcw50W+5jIil1QyJ XVtkArKLZVr+Lx4/42LdwF1vnbpuaTPJI14n/jN/mxmjXBfBmp6Q8jDOVjdXA0cuUDcaDJW4ppG 2ev1ZF4OsqCNXz4MK13gZYmrgnKTAIL3VapFF181y/2pLfxtEcvVA/8RmY= X-Google-Smtp-Source: AGHT+IEFdutyIapFlcsCKhcuaRLoXIhXE5DrGgWXzRdw4dxk16q8542OAAWupm+R9ohYioH5sjkIiQ== X-Received: by 2002:a05:6000:1f85:b0:385:f909:eb2c with SMTP id ffacd0b85a97d-38a87338c26mr34200153f8f.38.1737021418598; Thu, 16 Jan 2025 01:56:58 -0800 (PST) Received: from blackdock.suse.cz ([193.86.92.181]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74e6511sm54069945e9.38.2025.01.16.01.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 01:56:58 -0800 (PST) From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Cc: Waiman Long , Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Chen Ridong Subject: [PATCH] cgroup/cpuset: Move procfs cpuset attribute under cgroup-v1.c Date: Thu, 16 Jan 2025 10:56:56 +0100 Message-ID: <20250116095656.643976-1-mkoutny@suse.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The cpuset file is a legacy attribute that is bound primarily to cpuset v1 (and it'd be equal to effective /proc/$pid/cgroup path on the unified hierarchy). Followup to commit b0ced9d378d49 ("cgroup/cpuset: move v1 interfaces to cpuset-v1.c") and hide CONFIG_PROC_PID_CPUSET under CONFIG_CPUSETS_V1. Drop an obsolete comment too. Signed-off-by: Michal Koutn=C3=BD --- init/Kconfig | 2 +- kernel/cgroup/cpuset-v1.c | 40 +++++++++++++++++++++++++++++++++++ kernel/cgroup/cpuset.c | 44 --------------------------------------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index a20e6efd3f0fb..2a1d5ef3fa48e 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1190,7 +1190,7 @@ config CPUSETS_V1 =20 config PROC_PID_CPUSET bool "Include legacy /proc//cpuset file" - depends on CPUSETS + depends on CPUSETS_V1 default y =20 config CGROUP_DEVICE diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c index 25c1d7b77e2f2..fff1a38f2725f 100644 --- a/kernel/cgroup/cpuset-v1.c +++ b/kernel/cgroup/cpuset-v1.c @@ -373,6 +373,46 @@ int cpuset1_validate_change(struct cpuset *cur, struct= cpuset *trial) return ret; } =20 +#ifdef CONFIG_PROC_PID_CPUSET +/* + * proc_cpuset_show() + * - Print tasks cpuset path into seq_file. + * - Used for /proc//cpuset. + */ +int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, + struct pid *pid, struct task_struct *tsk) +{ + char *buf; + struct cgroup_subsys_state *css; + int retval; + + retval =3D -ENOMEM; + buf =3D kmalloc(PATH_MAX, GFP_KERNEL); + if (!buf) + goto out; + + rcu_read_lock(); + spin_lock_irq(&css_set_lock); + css =3D task_css(tsk, cpuset_cgrp_id); + retval =3D cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, + current->nsproxy->cgroup_ns); + spin_unlock_irq(&css_set_lock); + rcu_read_unlock(); + + if (retval =3D=3D -E2BIG) + retval =3D -ENAMETOOLONG; + if (retval < 0) + goto out_free; + seq_puts(m, buf); + seq_putc(m, '\n'); + retval =3D 0; +out_free: + kfree(buf); +out: + return retval; +} +#endif /* CONFIG_PROC_PID_CPUSET */ + static u64 cpuset_read_u64(struct cgroup_subsys_state *css, struct cftype = *cft) { struct cpuset *cs =3D css_cs(css); diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 0f910c828973a..7d6e8db234290 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -4244,50 +4244,6 @@ void cpuset_print_current_mems_allowed(void) rcu_read_unlock(); } =20 -#ifdef CONFIG_PROC_PID_CPUSET -/* - * proc_cpuset_show() - * - Print tasks cpuset path into seq_file. - * - Used for /proc//cpuset. - * - No need to task_lock(tsk) on this tsk->cpuset reference, as it - * doesn't really matter if tsk->cpuset changes after we read it, - * and we take cpuset_mutex, keeping cpuset_attach() from changing it - * anyway. - */ -int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, - struct pid *pid, struct task_struct *tsk) -{ - char *buf; - struct cgroup_subsys_state *css; - int retval; - - retval =3D -ENOMEM; - buf =3D kmalloc(PATH_MAX, GFP_KERNEL); - if (!buf) - goto out; - - rcu_read_lock(); - spin_lock_irq(&css_set_lock); - css =3D task_css(tsk, cpuset_cgrp_id); - retval =3D cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, - current->nsproxy->cgroup_ns); - spin_unlock_irq(&css_set_lock); - rcu_read_unlock(); - - if (retval =3D=3D -E2BIG) - retval =3D -ENAMETOOLONG; - if (retval < 0) - goto out_free; - seq_puts(m, buf); - seq_putc(m, '\n'); - retval =3D 0; -out_free: - kfree(buf); -out: - return retval; -} -#endif /* CONFIG_PROC_PID_CPUSET */ - /* Display task mems_allowed in /proc//status file. */ void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *ta= sk) { --=20 2.47.1