From nobody Sun Dec 14 02:14:14 2025 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (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 07B492EFDB5; Wed, 13 Aug 2025 08:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074614; cv=none; b=Tu3pXPStnXtbUGp4OCh4CsZwiStQqkTpm5H3Xh2eM5SGxo1OZGD7+U4fmmZZK5bhRErkmC3KtBG0OnwNIbpHHVS9/KOB2QhovGhyZF7JjxbPzXknzMmNf2JavNL7ycx1WUQlX3rRUbMb5W8yIRKxuruM3HxeCoo8aD4Su35iAf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074614; c=relaxed/simple; bh=RGt1tIYft6crFMNv5et40pBjMR6KEN1WAn93iGLySJg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FL5e3YUW5ImcWQqdvOEWt2QqojdPJzHAUcd+PIKOXjumMr0tfbIKtI0oB8JdWwMO+ICFuX5L4QX+IVsCh/GFFQ4UsODMcm7128j6gpjLhzD2VVXUp49SpKCCH7kfmbs3bP36vFvGoPlfBBixsi2JaDY+KZS3x+OYjzczhNiEIwE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4c222n5p22zYQvJF; Wed, 13 Aug 2025 16:43:29 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 671831A0EFC; Wed, 13 Aug 2025 16:43:28 +0800 (CST) Received: from hulk-vt.huawei.com (unknown [10.67.174.121]) by APP4 (Coremail) with SMTP id gCh0CgBHDg8qUJxoaYwdDg--.28644S3; Wed, 13 Aug 2025 16:43:28 +0800 (CST) From: Chen Ridong To: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, longman@redhat.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com, chenridong@huawei.com, christophe.jaillet@wanadoo.fr Subject: [-next v2 1/4] cpuset: remove redundant CS_ONLINE flag Date: Wed, 13 Aug 2025 08:29:01 +0000 Message-Id: <20250813082904.1091651-2-chenridong@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250813082904.1091651-1-chenridong@huaweicloud.com> References: <20250813082904.1091651-1-chenridong@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgBHDg8qUJxoaYwdDg--.28644S3 X-Coremail-Antispam: 1UD129KBjvJXoWxXF1xGFyxtFyxAw4DAr48Crg_yoW5tw1kpF 1DCFyUKw45GF17CaykG34qq34fKw4fZa4UKF1rK3s5AFyayFya9F1kZ345JFyUAFWkCrWU AF4SvrWY93W8trJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Kb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_Jw0_GFyl42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14 v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUFID7UUUUU X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ Content-Type: text/plain; charset="utf-8" From: Chen Ridong The CS_ONLINE flag was introduced prior to the CSS_ONLINE flag in the cpuset subsystem. Currently, the flag setting sequence is as follows: 1. cpuset_css_online() sets CS_ONLINE 2. css->flags gets CSS_ONLINE set ... 3. cgroup->kill_css sets CSS_DYING 4. cpuset_css_offline() clears CS_ONLINE 5. css->flags clears CSS_ONLINE The is_cpuset_online() check currently occurs between steps 1 and 3. However, it would be equally safe to perform this check between steps 2 and 3, as CSS_ONLINE provides the same synchronization guarantee as CS_ONLINE. Since CS_ONLINE is redundant with CSS_ONLINE and provides no additional synchronization benefits, we can safely remove it to simplify the code. Signed-off-by: Chen Ridong Acked-by: Waiman Long --- include/linux/cgroup.h | 5 +++++ kernel/cgroup/cpuset-internal.h | 3 +-- kernel/cgroup/cpuset.c | 4 +--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index b18fb5fcb38e..ae73dbb19165 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -354,6 +354,11 @@ static inline bool css_is_dying(struct cgroup_subsys_s= tate *css) return css->flags & CSS_DYING; } =20 +static inline bool css_is_online(struct cgroup_subsys_state *css) +{ + return css->flags & CSS_ONLINE; +} + static inline bool css_is_self(struct cgroup_subsys_state *css) { if (css =3D=3D &css->cgroup->self) { diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-interna= l.h index 383963e28ac6..75b3aef39231 100644 --- a/kernel/cgroup/cpuset-internal.h +++ b/kernel/cgroup/cpuset-internal.h @@ -38,7 +38,6 @@ enum prs_errcode { =20 /* bits in struct cpuset flags field */ typedef enum { - CS_ONLINE, CS_CPU_EXCLUSIVE, CS_MEM_EXCLUSIVE, CS_MEM_HARDWALL, @@ -202,7 +201,7 @@ static inline struct cpuset *parent_cs(struct cpuset *c= s) /* convenient tests for these bits */ static inline bool is_cpuset_online(struct cpuset *cs) { - return test_bit(CS_ONLINE, &cs->flags) && !css_is_dying(&cs->css); + return css_is_online(&cs->css) && !css_is_dying(&cs->css); } =20 static inline int is_cpu_exclusive(const struct cpuset *cs) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 27adb04df675..3466ebbf1016 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -207,7 +207,7 @@ static inline void notify_partition_change(struct cpuse= t *cs, int old_prs) * parallel, we may leave an offline CPU in cpu_allowed or some other mask= s. */ static struct cpuset top_cpuset =3D { - .flags =3D BIT(CS_ONLINE) | BIT(CS_CPU_EXCLUSIVE) | + .flags =3D BIT(CS_CPU_EXCLUSIVE) | BIT(CS_MEM_EXCLUSIVE) | BIT(CS_SCHED_LOAD_BALANCE), .partition_root_state =3D PRS_ROOT, .relax_domain_level =3D -1, @@ -3496,7 +3496,6 @@ static int cpuset_css_online(struct cgroup_subsys_sta= te *css) cpus_read_lock(); mutex_lock(&cpuset_mutex); =20 - set_bit(CS_ONLINE, &cs->flags); if (is_spread_page(parent)) set_bit(CS_SPREAD_PAGE, &cs->flags); if (is_spread_slab(parent)) @@ -3571,7 +3570,6 @@ static void cpuset_css_offline(struct cgroup_subsys_s= tate *css) cpuset_update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); =20 cpuset_dec(); - clear_bit(CS_ONLINE, &cs->flags); =20 mutex_unlock(&cpuset_mutex); cpus_read_unlock(); --=20 2.34.1 From nobody Sun Dec 14 02:14:14 2025 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 16D4E2F0691; Wed, 13 Aug 2025 08:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074614; cv=none; b=l5/r7MnU9qprG1wbRCDZ/keZtwCDcc3feMEExHeeO1fFsMlcymcHVhhYf//D4ptm52C1RGk6onxjcrQamme8/a+/oSLt3KPArkqMdnh8XV71FQMnB7abueOmRK86hRY2kZjQQ7gplBL9VwFSTEezevTHdVXhEQwJHQYUcserfj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074614; c=relaxed/simple; bh=LDoKSLv6DaS71m95O+3GWjqRdNCs5dlPBklDENMne4I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gGiJvmYqkFcEoRiLUUa2HisKMEqJT0WG61zL2qnfMRWwpfV/jMAdmYrDOCkmtwwVqK3rjTBnUX3rSOBTnpLk3amVtSn7hui1j8CjN92QpqguBKACV261yqpJOquZwrzrIafcYCT7U1WS7FMYMZueh7546abupwZ/jefoRcbSrL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4c222n1Q1kzKHMx3; Wed, 13 Aug 2025 16:43:29 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 727D01A1B99; Wed, 13 Aug 2025 16:43:28 +0800 (CST) Received: from hulk-vt.huawei.com (unknown [10.67.174.121]) by APP4 (Coremail) with SMTP id gCh0CgBHDg8qUJxoaYwdDg--.28644S4; Wed, 13 Aug 2025 16:43:28 +0800 (CST) From: Chen Ridong To: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, longman@redhat.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com, chenridong@huawei.com, christophe.jaillet@wanadoo.fr Subject: [-next v2 2/4] cpuset: decouple tmpmaks and cpumaks of cs free Date: Wed, 13 Aug 2025 08:29:02 +0000 Message-Id: <20250813082904.1091651-3-chenridong@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250813082904.1091651-1-chenridong@huaweicloud.com> References: <20250813082904.1091651-1-chenridong@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgBHDg8qUJxoaYwdDg--.28644S4 X-Coremail-Antispam: 1UD129KBjvJXoWxJF1fXF13Wr4xZry8tFWUJwb_yoW5AFy7pF WYkFW7G3yUJr18W34DJa97Xr1Sk3ykt34kK3sxJ3s5GFyav3y0vFy7Z3sYq3yYkFykWF43 JFWDtr4SgFyUtrUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Kb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUXw A2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_Jw0_GFyl42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14 v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU7v38UUUUU X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ Content-Type: text/plain; charset="utf-8" From: Chen Ridong Currently, free_cpumasks can free tmpmasks of cpumask of cs. However, it doesn't have couple these 2 options. To make the function more clearer, move the freeing of cpumask in cs to the free_cpuset. And rename the free_cpumasks to the free_tmpmasks. which is Single responsibility. Signed-off-by: Chen Ridong --- kernel/cgroup/cpuset.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 3466ebbf1016..aebda14cc67f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -459,23 +459,14 @@ static inline int alloc_cpumasks(struct cpuset *cs, s= truct tmpmasks *tmp) } =20 /** - * free_cpumasks - free cpumasks in a tmpmasks structure - * @cs: the cpuset that have cpumasks to be free. + * free_tmpmasks - free cpumasks in a tmpmasks structure * @tmp: the tmpmasks structure pointer */ -static inline void free_cpumasks(struct cpuset *cs, struct tmpmasks *tmp) +static inline void free_tmpmasks(struct tmpmasks *tmp) { - if (cs) { - free_cpumask_var(cs->cpus_allowed); - free_cpumask_var(cs->effective_cpus); - free_cpumask_var(cs->effective_xcpus); - free_cpumask_var(cs->exclusive_cpus); - } - if (tmp) { - free_cpumask_var(tmp->new_cpus); - free_cpumask_var(tmp->addmask); - free_cpumask_var(tmp->delmask); - } + free_cpumask_var(tmp->new_cpus); + free_cpumask_var(tmp->addmask); + free_cpumask_var(tmp->delmask); } =20 /** @@ -508,7 +499,10 @@ static struct cpuset *alloc_trial_cpuset(struct cpuset= *cs) */ static inline void free_cpuset(struct cpuset *cs) { - free_cpumasks(cs, NULL); + free_cpumask_var(cs->cpus_allowed); + free_cpumask_var(cs->effective_cpus); + free_cpumask_var(cs->effective_xcpus); + free_cpumask_var(cs->exclusive_cpus); kfree(cs); } =20 @@ -2427,7 +2421,7 @@ static int update_cpumask(struct cpuset *cs, struct c= puset *trialcs, if (cs->partition_root_state) update_partition_sd_lb(cs, old_prs); out_free: - free_cpumasks(NULL, &tmp); + free_tmpmasks(&tmp); return retval; } =20 @@ -2530,7 +2524,7 @@ static int update_exclusive_cpumask(struct cpuset *cs= , struct cpuset *trialcs, if (cs->partition_root_state) update_partition_sd_lb(cs, old_prs); =20 - free_cpumasks(NULL, &tmp); + free_tmpmasks(&tmp); return 0; } =20 @@ -2983,7 +2977,7 @@ static int update_prstate(struct cpuset *cs, int new_= prs) notify_partition_change(cs, old_prs); if (force_sd_rebuild) rebuild_sched_domains_locked(); - free_cpumasks(NULL, &tmpmask); + free_tmpmasks(&tmpmask); return 0; } =20 @@ -4006,7 +4000,7 @@ static void cpuset_handle_hotplug(void) if (force_sd_rebuild) rebuild_sched_domains_cpuslocked(); =20 - free_cpumasks(NULL, ptmp); + free_tmpmasks(ptmp); } =20 void cpuset_update_active_cpus(void) --=20 2.34.1 From nobody Sun Dec 14 02:14:14 2025 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (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 07A212EE5FE; Wed, 13 Aug 2025 08:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074613; cv=none; b=uiuRsI99DnY2XbZW2O7/USGEh1dYM+Ewgfz/UjW9kr4vhGRr/NokCu4Mo0QpCKVzyvtXRnL8p1wG62Z/0DItt4hT26jzM2osCtCrmTdjieQXlWT8TYMjQUK2oq3rOhE6BfwaUpgwFhu1otjPGzyGG/btty/PoPXFB6Tx6e99i7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074613; c=relaxed/simple; bh=IbL18Ly7endX98//AwfH2mqL/1RH4Eg1h8V4HpUJzh4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=T8gJZu3JUHVgPqwGbU+H8VaDHbbH/v3a9tdeht1h2RyOFXCmw0M8JTWngfAiq4a7Vl9MXgZIQY4srElfcL50SkUuy3aY/T85KDx0icBJva8Mmkz+7fyDM6pVHNOLTCcjl3C6jXqeQoVYg68EXBxXwNQfJtDDNSQxKmHZ7nuHvZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4c222n6NVmzYQvLH; Wed, 13 Aug 2025 16:43:29 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 8238F1A1B9F; Wed, 13 Aug 2025 16:43:28 +0800 (CST) Received: from hulk-vt.huawei.com (unknown [10.67.174.121]) by APP4 (Coremail) with SMTP id gCh0CgBHDg8qUJxoaYwdDg--.28644S5; Wed, 13 Aug 2025 16:43:28 +0800 (CST) From: Chen Ridong To: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, longman@redhat.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com, chenridong@huawei.com, christophe.jaillet@wanadoo.fr Subject: [-next v2 3/4] cpuset: separate tmpmasks and cpuset allocation logic Date: Wed, 13 Aug 2025 08:29:03 +0000 Message-Id: <20250813082904.1091651-4-chenridong@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250813082904.1091651-1-chenridong@huaweicloud.com> References: <20250813082904.1091651-1-chenridong@huaweicloud.com> 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 X-CM-TRANSID: gCh0CgBHDg8qUJxoaYwdDg--.28644S5 X-Coremail-Antispam: 1UD129KBjvJXoWxtFWfuFW3ZF43uw4UtrW5ZFb_yoWxtryrpF 4rCrWUKayUJr18Ww4UG3Z7Gr1fK3yvqa4qy3W5XryruFyaqF4I9FyDJ3sYvay7CasrCF15 XF98Aw4IgFyDKrUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Kb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWw A2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_Jw0_GFyl42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14 v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUOGQ6DUUUU X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ From: Chen Ridong The original alloc_cpumasks() served dual purposes: allocating cpumasks for both temporary masks (tmpmasks) and cpuset structures. This patch: 1. Decouples these allocation paths for better code clarity 2. Introduces dedicated alloc_tmpmasks() and dup_or_alloc_cpuset() functions 3. Maintains symmetric pairing: - alloc_tmpmasks() =E2=86=94 free_tmpmasks() - dup_or_alloc_cpuset() =E2=86=94 free_cpuset() Signed-off-by: Chen Ridong --- kernel/cgroup/cpuset.c | 128 ++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 59 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index aebda14cc67f..3c5e44f824d1 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -411,51 +411,46 @@ static void guarantee_online_mems(struct cpuset *cs, = nodemask_t *pmask) } =20 /** - * alloc_cpumasks - allocate three cpumasks for cpuset - * @cs: the cpuset that have cpumasks to be allocated. - * @tmp: the tmpmasks structure pointer - * Return: 0 if successful, -ENOMEM otherwise. + * alloc_cpumasks - Allocate an array of cpumask variables + * @cpumasks: Pointer to array of cpumask_var_t pointers + * @size: Number of cpumasks to allocate * - * Only one of the two input arguments should be non-NULL. + * Allocates @size cpumasks and initializes them to empty. Returns 0 on + * success, -ENOMEM on allocation failure. On failure, any previously + * allocated cpumasks are freed. */ -static inline int alloc_cpumasks(struct cpuset *cs, struct tmpmasks *tmp) +static inline int alloc_cpumasks(cpumask_var_t *pmasks[], u32 size) { - cpumask_var_t *pmask1, *pmask2, *pmask3, *pmask4; + int i; =20 - if (cs) { - pmask1 =3D &cs->cpus_allowed; - pmask2 =3D &cs->effective_cpus; - pmask3 =3D &cs->effective_xcpus; - pmask4 =3D &cs->exclusive_cpus; - } else { - pmask1 =3D &tmp->new_cpus; - pmask2 =3D &tmp->addmask; - pmask3 =3D &tmp->delmask; - pmask4 =3D NULL; + for (i =3D 0; i < size; i++) { + if (!zalloc_cpumask_var(pmasks[i], GFP_KERNEL)) { + while (--i >=3D 0) + free_cpumask_var(*pmasks[i]); + return -ENOMEM; + } } - - if (!zalloc_cpumask_var(pmask1, GFP_KERNEL)) - return -ENOMEM; - - if (!zalloc_cpumask_var(pmask2, GFP_KERNEL)) - goto free_one; - - if (!zalloc_cpumask_var(pmask3, GFP_KERNEL)) - goto free_two; - - if (pmask4 && !zalloc_cpumask_var(pmask4, GFP_KERNEL)) - goto free_three; - - return 0; +} =20 -free_three: - free_cpumask_var(*pmask3); -free_two: - free_cpumask_var(*pmask2); -free_one: - free_cpumask_var(*pmask1); - return -ENOMEM; +/** + * alloc_tmpmasks - Allocate temporary cpumasks for cpuset operations. + * @tmp: Pointer to tmpmasks structure to populate + * Return: 0 on success, -ENOMEM on allocation failure + */ +static inline int alloc_tmpmasks(struct tmpmasks *tmp) +{ + /* + * Array of pointers to the three cpumask_var_t fields in tmpmasks. + * Note: Array size must match actual number of masks (3) + */ + cpumask_var_t *pmask[3] =3D { + &tmp->new_cpus, + &tmp->addmask, + &tmp->delmask + }; + + return alloc_cpumasks(pmask, ARRAY_SIZE(pmask)); } =20 /** @@ -470,26 +465,46 @@ static inline void free_tmpmasks(struct tmpmasks *tmp) } =20 /** - * alloc_trial_cpuset - allocate a trial cpuset - * @cs: the cpuset that the trial cpuset duplicates + * dup_or_alloc_cpuset - Duplicate or allocate a new cpuset + * @cs: Source cpuset to duplicate (NULL for a fresh allocation) + * + * Creates a new cpuset by either: + * 1. Duplicating an existing cpuset (if @cs is non-NULL), or + * 2. Allocating a fresh cpuset with zero-initialized masks (if @cs is NUL= L) + * + * Return: Pointer to newly allocated cpuset on success, NULL on failure */ -static struct cpuset *alloc_trial_cpuset(struct cpuset *cs) +static struct cpuset *dup_or_alloc_cpuset(struct cpuset *cs) { struct cpuset *trial; =20 - trial =3D kmemdup(cs, sizeof(*cs), GFP_KERNEL); + /* Allocate base structure */ + trial =3D cs ? kmemdup(cs, sizeof(*cs), GFP_KERNEL) : + kzalloc(sizeof(*cs), GFP_KERNEL); if (!trial) return NULL; =20 - if (alloc_cpumasks(trial, NULL)) { + /* Setup cpumask pointer array */ + cpumask_var_t *pmask[4] =3D { + &trial->cpus_allowed, + &trial->effective_cpus, + &trial->effective_xcpus, + &trial->exclusive_cpus + }; + + if (alloc_cpumasks(pmask, ARRAY_SIZE(pmask))) { kfree(trial); return NULL; } =20 - cpumask_copy(trial->cpus_allowed, cs->cpus_allowed); - cpumask_copy(trial->effective_cpus, cs->effective_cpus); - cpumask_copy(trial->effective_xcpus, cs->effective_xcpus); - cpumask_copy(trial->exclusive_cpus, cs->exclusive_cpus); + /* Copy masks if duplicating */ + if (cs) { + cpumask_copy(trial->cpus_allowed, cs->cpus_allowed); + cpumask_copy(trial->effective_cpus, cs->effective_cpus); + cpumask_copy(trial->effective_xcpus, cs->effective_xcpus); + cpumask_copy(trial->exclusive_cpus, cs->exclusive_cpus); + } + return trial; } =20 @@ -2332,7 +2347,7 @@ static int update_cpumask(struct cpuset *cs, struct c= puset *trialcs, if (cpumask_equal(cs->cpus_allowed, trialcs->cpus_allowed)) return 0; =20 - if (alloc_cpumasks(NULL, &tmp)) + if (alloc_tmpmasks(&tmp)) return -ENOMEM; =20 if (old_prs) { @@ -2476,7 +2491,7 @@ static int update_exclusive_cpumask(struct cpuset *cs= , struct cpuset *trialcs, if (retval) return retval; =20 - if (alloc_cpumasks(NULL, &tmp)) + if (alloc_tmpmasks(&tmp)) return -ENOMEM; =20 if (old_prs) { @@ -2820,7 +2835,7 @@ int cpuset_update_flag(cpuset_flagbits_t bit, struct = cpuset *cs, int spread_flag_changed; int err; =20 - trialcs =3D alloc_trial_cpuset(cs); + trialcs =3D dup_or_alloc_cpuset(cs); if (!trialcs) return -ENOMEM; =20 @@ -2881,7 +2896,7 @@ static int update_prstate(struct cpuset *cs, int new_= prs) if (new_prs && is_prs_invalid(old_prs)) old_prs =3D PRS_MEMBER; =20 - if (alloc_cpumasks(NULL, &tmpmask)) + if (alloc_tmpmasks(&tmpmask)) return -ENOMEM; =20 err =3D update_partition_exclusive_flag(cs, new_prs); @@ -3223,7 +3238,7 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file = *of, if (!is_cpuset_online(cs)) goto out_unlock; =20 - trialcs =3D alloc_trial_cpuset(cs); + trialcs =3D dup_or_alloc_cpuset(cs); if (!trialcs) { retval =3D -ENOMEM; goto out_unlock; @@ -3456,15 +3471,10 @@ cpuset_css_alloc(struct cgroup_subsys_state *parent= _css) if (!parent_css) return &top_cpuset.css; =20 - cs =3D kzalloc(sizeof(*cs), GFP_KERNEL); + cs =3D dup_or_alloc_cpuset(NULL); if (!cs) return ERR_PTR(-ENOMEM); =20 - if (alloc_cpumasks(cs, NULL)) { - kfree(cs); - return ERR_PTR(-ENOMEM); - } - __set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags); fmeter_init(&cs->fmeter); cs->relax_domain_level =3D -1; @@ -3920,7 +3930,7 @@ static void cpuset_handle_hotplug(void) bool on_dfl =3D is_in_v2_mode(); struct tmpmasks tmp, *ptmp =3D NULL; =20 - if (on_dfl && !alloc_cpumasks(NULL, &tmp)) + if (on_dfl && !alloc_tmpmasks(&tmp)) ptmp =3D &tmp; =20 lockdep_assert_cpus_held(); --=20 2.34.1 From nobody Sun Dec 14 02:14:14 2025 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 16DE52F0692; Wed, 13 Aug 2025 08:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074613; cv=none; b=PfW8H1GFva67t9wJNYEHHcYF+YdLbus7E+Mx81Z3VnXuQv582bzwMirLc8p08uqBF9wPZbe40D7tj2F5lRtJVXYGnl4YOCObj0Or71vyv2iZdAwstFmZCHHQ0ONIYdcXlQmtdEH57VvMYjIstU308by38MIshZw5RlE71fUENu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755074613; c=relaxed/simple; bh=OdgxX4Rn7gFH8ZsT0xUJqucClnQOuiA6GibA7838GO4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AX2x7Biqpmb8RKu8O3Qa21vMw3P61c+3KOIvY+/uVJGLydMcg7luIhuEcTRNZoopFcnwFbZSQKHFVgCjXMhZ6DpV8Ggocc9htpQq6mcxfKVjOTQvmsYmzvhhx32r9cvP6POvQS5erVWdXD+2zPxPBhH7gW+BKct4CdCrevWTWec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4c222n2JtDzKHMx3; Wed, 13 Aug 2025 16:43:29 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 933361A1BA6; Wed, 13 Aug 2025 16:43:28 +0800 (CST) Received: from hulk-vt.huawei.com (unknown [10.67.174.121]) by APP4 (Coremail) with SMTP id gCh0CgBHDg8qUJxoaYwdDg--.28644S6; Wed, 13 Aug 2025 16:43:28 +0800 (CST) From: Chen Ridong To: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, longman@redhat.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com, chenridong@huawei.com, christophe.jaillet@wanadoo.fr Subject: [-next v2 4/4] cpuset: add helpers for cpus read and cpuset_mutex locks Date: Wed, 13 Aug 2025 08:29:04 +0000 Message-Id: <20250813082904.1091651-5-chenridong@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250813082904.1091651-1-chenridong@huaweicloud.com> References: <20250813082904.1091651-1-chenridong@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgBHDg8qUJxoaYwdDg--.28644S6 X-Coremail-Antispam: 1UD129KBjvJXoWxuFWfuryftF47Kr4rXF48tFb_yoW7CrWDpF yq9rW7trWUtrs7uw13G34Dur18Kw1jgF4UGF1kJ3WrZFy7AFsI9FyDCasxWr1Ygry7Crn8 W3Zruws0vayDJr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB0b4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_Jw0_GFyl42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUoo7KUUUUU X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ Content-Type: text/plain; charset="utf-8" From: Chen Ridong cpuset: add helpers for cpus_read_lock and cpuset_mutex Replace repetitive locking patterns with new helpers: - cpus_read_cpuset_lock() - cpus_read_cpuset_unlock() This makes the code cleaner and ensures consistent lock ordering. Signed-off-by: Chen Ridong --- kernel/cgroup/cpuset-internal.h | 2 ++ kernel/cgroup/cpuset-v1.c | 12 +++------ kernel/cgroup/cpuset.c | 48 +++++++++++++++------------------ 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-interna= l.h index 75b3aef39231..6fb00c96044d 100644 --- a/kernel/cgroup/cpuset-internal.h +++ b/kernel/cgroup/cpuset-internal.h @@ -276,6 +276,8 @@ int cpuset_update_flag(cpuset_flagbits_t bit, struct cp= uset *cs, int turning_on) ssize_t cpuset_write_resmask(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off); int cpuset_common_seq_show(struct seq_file *sf, void *v); +void cpus_read_cpuset_lock(void); +void cpus_read_cpuset_unlock(void); =20 /* * cpuset-v1.c diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c index b69a7db67090..f3d2d116c842 100644 --- a/kernel/cgroup/cpuset-v1.c +++ b/kernel/cgroup/cpuset-v1.c @@ -169,8 +169,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state = *css, struct cftype *cft, cpuset_filetype_t type =3D cft->private; int retval =3D -ENODEV; =20 - cpus_read_lock(); - cpuset_lock(); + cpus_read_cpuset_lock(); if (!is_cpuset_online(cs)) goto out_unlock; =20 @@ -184,8 +183,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state = *css, struct cftype *cft, break; } out_unlock: - cpuset_unlock(); - cpus_read_unlock(); + cpus_read_cpuset_unlock(); return retval; } =20 @@ -454,8 +452,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state = *css, struct cftype *cft, cpuset_filetype_t type =3D cft->private; int retval =3D 0; =20 - cpus_read_lock(); - cpuset_lock(); + cpus_read_cpuset_lock(); if (!is_cpuset_online(cs)) { retval =3D -ENODEV; goto out_unlock; @@ -498,8 +495,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state = *css, struct cftype *cft, break; } out_unlock: - cpuset_unlock(); - cpus_read_unlock(); + cpus_read_cpuset_unlock(); return retval; } =20 diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 3c5e44f824d1..9c0e8f297aaf 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -260,6 +260,18 @@ void cpuset_unlock(void) mutex_unlock(&cpuset_mutex); } =20 +void cpus_read_cpuset_lock(void) +{ + cpus_read_lock(); + mutex_lock(&cpuset_mutex); +} + +void cpus_read_cpuset_unlock(void) +{ + mutex_unlock(&cpuset_mutex); + cpus_read_unlock(); +} + static DEFINE_SPINLOCK(callback_lock); =20 void cpuset_callback_lock_irq(void) @@ -3233,8 +3245,7 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file = *of, int retval =3D -ENODEV; =20 buf =3D strstrip(buf); - cpus_read_lock(); - mutex_lock(&cpuset_mutex); + cpus_read_cpuset_lock(); if (!is_cpuset_online(cs)) goto out_unlock; =20 @@ -3263,8 +3274,7 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file = *of, if (force_sd_rebuild) rebuild_sched_domains_locked(); out_unlock: - mutex_unlock(&cpuset_mutex); - cpus_read_unlock(); + cpus_read_cpuset_unlock(); flush_workqueue(cpuset_migrate_mm_wq); return retval ?: nbytes; } @@ -3367,12 +3377,10 @@ static ssize_t cpuset_partition_write(struct kernfs= _open_file *of, char *buf, else return -EINVAL; =20 - cpus_read_lock(); - mutex_lock(&cpuset_mutex); + cpus_read_cpuset_lock(); if (is_cpuset_online(cs)) retval =3D update_prstate(cs, val); - mutex_unlock(&cpuset_mutex); - cpus_read_unlock(); + cpus_read_cpuset_unlock(); return retval ?: nbytes; } =20 @@ -3497,9 +3505,7 @@ static int cpuset_css_online(struct cgroup_subsys_sta= te *css) if (!parent) return 0; =20 - cpus_read_lock(); - mutex_lock(&cpuset_mutex); - + cpus_read_cpuset_lock(); if (is_spread_page(parent)) set_bit(CS_SPREAD_PAGE, &cs->flags); if (is_spread_slab(parent)) @@ -3551,8 +3557,7 @@ static int cpuset_css_online(struct cgroup_subsys_sta= te *css) cpumask_copy(cs->effective_cpus, parent->cpus_allowed); spin_unlock_irq(&callback_lock); out_unlock: - mutex_unlock(&cpuset_mutex); - cpus_read_unlock(); + cpus_read_cpuset_unlock(); return 0; } =20 @@ -3567,16 +3572,12 @@ static void cpuset_css_offline(struct cgroup_subsys= _state *css) { struct cpuset *cs =3D css_cs(css); =20 - cpus_read_lock(); - mutex_lock(&cpuset_mutex); - + cpus_read_cpuset_lock(); if (!cpuset_v2() && is_sched_load_balance(cs)) cpuset_update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); =20 cpuset_dec(); - - mutex_unlock(&cpuset_mutex); - cpus_read_unlock(); + cpus_read_cpuset_unlock(); } =20 /* @@ -3588,16 +3589,11 @@ static void cpuset_css_killed(struct cgroup_subsys_= state *css) { struct cpuset *cs =3D css_cs(css); =20 - cpus_read_lock(); - mutex_lock(&cpuset_mutex); - + cpus_read_cpuset_lock(); /* Reset valid partition back to member */ if (is_partition_valid(cs)) update_prstate(cs, PRS_MEMBER); - - mutex_unlock(&cpuset_mutex); - cpus_read_unlock(); - + cpus_read_cpuset_unlock(); } =20 static void cpuset_css_free(struct cgroup_subsys_state *css) --=20 2.34.1