From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A50851E2847 for ; Mon, 20 Jan 2025 15:16:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737386204; cv=none; b=fGpre2xt5n12dxhVnW1+nU7ny9Rf0HV2ysEFI1/euMTgBu1nOs2JR6uEdUeQEXldIFirTiu2IckMgexZ95B00wWz0CDCeUcd0Hu+TDutTT7WC0uUZebdZjl/Kabz1hD/mqxY15Fp/rFr65yBD88jzzKGA7diLdSYnWevr0VRn0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737386204; c=relaxed/simple; bh=9+9b9SG5sk+pAABUD6zvKqDzoH/IskHcubMLq+I3ta0=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=fS9oKA0MaeLiRe7baWwt/FIPt4s9QqMAI9ab6NZ+QZe3IsFKfNzwPeHWmQwEwa+FG2Vc1TXGG7MMLEyqh3RRk+Vbbg+tuyJGYu8C+SVU0d9tKKtt41JgMRTWVvoOM6QUEG2mHdRmtU/pJwpp5jpmENh/yvWU4VwHGU/KczD8QA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OxiMN/fj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OxiMN/fj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737386201; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=KFVwk2VrsevalC6D6th0fx99IWTy+CMBjZ3Dt3EDL28=; b=OxiMN/fjdJw7I/KoA5t72/KSE3hG3QALGLztQVGjzShZ7kOriGToE3AQJuYSogXXC07LKQ Dyi7NICckcRf0pYkkN0hsFI//nlEwGJA2krAzJw7aLsMhRIDOTqUu9gcJKNYbZCuBDUfyv cb9tEaQdLossRg/5hInrbuabYspvOc8= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-AaKEG4VDOXGH-ggVla_UnQ-1; Mon, 20 Jan 2025 10:16:40 -0500 X-MC-Unique: AaKEG4VDOXGH-ggVla_UnQ-1 X-Mimecast-MFC-AGG-ID: AaKEG4VDOXGH-ggVla_UnQ Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7bb849aa5fbso1056483885a.0 for ; Mon, 20 Jan 2025 07:16:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737386200; x=1737991000; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KFVwk2VrsevalC6D6th0fx99IWTy+CMBjZ3Dt3EDL28=; b=BS0bsPKDRBpadely+0BPa6l3cX1sW+HD1vMCSBiR42YP2sym22Mo374uvHHZvikZfV Y2NVQwWsocSD4/fsNMvsTlF5nVxKErV+oOv3UfJXihY3sSkGlacl2+lq1AeBUD5O3Rga /IBTYkcLRswZUas4tuaGzJiHs7nXv2bBklVHhLa5rO6WlJ/VmxyyZhNOsP1h89Al7anj sxQn2ROYSoI/ONTZX3rDoWneF5vRja85eQR3GbsmGMtHxTdPq0g/u7XHBhqv8k9UBS1z 6oYAgv7OEvhblS6juJPsBEOkFozf+s8z0oGZk6FR4JW+Ufyeb3P3pQIBxuUlaj/gjGeC pMbw== X-Forwarded-Encrypted: i=1; AJvYcCVQ1FsCSTcEGAGUoF5JWoix5sHnGcGoMX6jVh8ZVDitO3a2rlMRL+0WEBo+dukMG/rrbQafoHkYkWpfs+M=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8eLjh04VpPfQjful/rR9GnWHsmSWKmy7G0mZWbCZMopNO+NHB 9+0XqeUQ8Pq4jO3qetBFPXJNh9zcS7XSxXI9ZmIkS5pUwDQYYWpZ2hKAhLmDezbIbrne60WO92X geb5J5nNU+SpciK6nP6wRi/gBKFURXUa4yyaNmQOouJGVmzUApu6lhPijdtsvjg== X-Gm-Gg: ASbGncvpApFMaIoNr84dSKdyXLxtmvgx/JTOej1YjkxArXwdg1bXQuqC47ktsDBSMWb hlTwSxSHmYiE4m0olOJPYkJcGgTvDktv9vIydb3afMJV0AouOVcloCua3rG4OJoDfQsbxY+0/sJ 48Qd6r730ny4mHgfnyfXisbshBp3LWNywkzbE6ZUbOCnI6wxcRu4vOnnrCvZUrb8dcQJqUlfIFR e+F1rDrwGn8kgG32g2jxNRvB+YJKKJWoZSmOnXcuZ94piwL2euSv+gLYnq1sx42CKNwt7k1ryzP cwPImR7bOUJeDoDEDBHaSqTfK6TM9tlaYHrTkpIG X-Received: by 2002:a05:620a:2888:b0:7b6:c695:fb7c with SMTP id af79cd13be357-7be6320c398mr2036648585a.33.1737386199925; Mon, 20 Jan 2025 07:16:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAugYu7eAzmB+V9801n/X6ILhXl5Iy718gPDbhQMp+yDHefGSzACN/HgoHHGjsPG6oXOpdJQ== X-Received: by 2002:a05:620a:2888:b0:7b6:c695:fb7c with SMTP id af79cd13be357-7be6320c398mr2036645285a.33.1737386199619; Mon, 20 Jan 2025 07:16:39 -0800 (PST) Received: from ?IPV6:2601:188:c100:5710:315f:57b3:b997:5fca? ([2601:188:c100:5710:315f:57b3:b997:5fca]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be6147f46fsm452707485a.35.2025.01.20.07.16.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jan 2025 07:16:39 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: Date: Mon, 20 Jan 2025 10:16:38 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] cgroup/cpuset: Move procfs cpuset attribute under cgroup-v1.c To: =?UTF-8?Q?Michal_Koutn=C3=BD?= , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Cc: Tejun Heo , Johannes Weiner , Chen Ridong References: <20250120145749.925170-1-mkoutny@suse.com> Content-Language: en-US In-Reply-To: <20250120145749.925170-1-mkoutny@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/20/25 9:57 AM, Michal Koutný wrote: > The cpuset file is a legacy attribute that is bound primarily to cpuset > v1 hierarchy (equivalent information is available in /proc/$pid/cgroup path > on the unified hierarchy in conjunction with respective > cgroup.controllers showing where cpuset controller is enabled). > > 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ý > --- > init/Kconfig | 5 +++-- > kernel/cgroup/cpuset-v1.c | 41 +++++++++++++++++++++++++++++++++++ > kernel/cgroup/cpuset.c | 45 --------------------------------------- > 3 files changed, 44 insertions(+), 47 deletions(-) > > v3 changes: > - move dependency on internal cgroup-internal.h to v1-only too > Reported-by: kernel test robot > Link: https://lore.kernel.org/oe-kbuild-all/202501180315.KcDn5BG5-lkp@intel.com/ > > v2 changes: > - explicitly say what's part of CPUSETS_V1 > - commit message wrt effective paths Acked-by: Waiman Long > > diff --git a/init/Kconfig b/init/Kconfig > index a20e6efd3f0fb..2f3121c49ed23 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -1182,7 +1182,8 @@ config CPUSETS_V1 > help > Legacy cgroup v1 cpusets controller which has been deprecated by > cgroup v2 implementation. The v1 is there for legacy applications > - which haven't migrated to the new cgroup v2 interface yet. If you > + which haven't migrated to the new cgroup v2 interface yet. Legacy > + interface includes cpuset filesystem and /proc//cpuset. If you > do not have any such application then you are completely fine leaving > this option disabled. > > @@ -1190,7 +1191,7 @@ config CPUSETS_V1 > > config PROC_PID_CPUSET > bool "Include legacy /proc//cpuset file" > - depends on CPUSETS > + depends on CPUSETS_V1 > default y > > config CGROUP_DEVICE > diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c > index 25c1d7b77e2f2..81b5e2a50d587 100644 > --- a/kernel/cgroup/cpuset-v1.c > +++ b/kernel/cgroup/cpuset-v1.c > @@ -1,5 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0-or-later > > +#include "cgroup-internal.h" > #include "cpuset-internal.h" > > /* > @@ -373,6 +374,46 @@ int cpuset1_validate_change(struct cpuset *cur, struct cpuset *trial) > return ret; > } > > +#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 = -ENOMEM; > + buf = kmalloc(PATH_MAX, GFP_KERNEL); > + if (!buf) > + goto out; > + > + rcu_read_lock(); > + spin_lock_irq(&css_set_lock); > + css = task_css(tsk, cpuset_cgrp_id); > + retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, > + current->nsproxy->cgroup_ns); > + spin_unlock_irq(&css_set_lock); > + rcu_read_unlock(); > + > + if (retval == -E2BIG) > + retval = -ENAMETOOLONG; > + if (retval < 0) > + goto out_free; > + seq_puts(m, buf); > + seq_putc(m, '\n'); > + retval = 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 = css_cs(css); > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 0f910c828973a..5a637292faa20 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -21,7 +21,6 @@ > * License. See the file COPYING in the main directory of the Linux > * distribution for more details. > */ > -#include "cgroup-internal.h" > #include "cpuset-internal.h" > > #include > @@ -4244,50 +4243,6 @@ void cpuset_print_current_mems_allowed(void) > rcu_read_unlock(); > } > > -#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 = -ENOMEM; > - buf = kmalloc(PATH_MAX, GFP_KERNEL); > - if (!buf) > - goto out; > - > - rcu_read_lock(); > - spin_lock_irq(&css_set_lock); > - css = task_css(tsk, cpuset_cgrp_id); > - retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, > - current->nsproxy->cgroup_ns); > - spin_unlock_irq(&css_set_lock); > - rcu_read_unlock(); > - > - if (retval == -E2BIG) > - retval = -ENAMETOOLONG; > - if (retval < 0) > - goto out_free; > - seq_puts(m, buf); > - seq_putc(m, '\n'); > - retval = 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 *task) > {