From mboxrd@z Thu Jan 1 00:00:00 1970 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 449C12DEA96; Sat, 25 Oct 2025 07:03:57 +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=1761375838; cv=none; b=pQ9Qza2UXZ+Ig1jU5VcgoQpNGaTwstp5a8Xt96z6IvGN/qtkZE68gXY40/0D9C1iKVzec+TdflpIMrHxlgubMedq/anDrtdzP4O3cOcpApaUoSmiUKgg8DhhTympoKtiD0BYi6cdv7e1kohfSHBomT61UjISHob6C3xYdmAatGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761375838; c=relaxed/simple; bh=bSNw1CHCTGw3XYSkhmVF9VXHREISGnmU97JFH1sTxKk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gLCY3/SK6QE4smVk578XuCORkvKyrqikDkPrD1RwNTwRnr0FMCb/dLRwEbD9KFxgMNaMPcPkekyUUp1zJtipscfkZku97I7Vdu9yFY+bDmmfgqv6wELm1qkKybApswlzIfwfnVz2KuH8swCnHVFtaZ/KKf+fyzAx5bXMs8/uuOI= 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.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4ctrLz0Q5MzYQttS; Sat, 25 Oct 2025 15:02:51 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id E94DF1A1225; Sat, 25 Oct 2025 15:03:49 +0800 (CST) Received: from hulk-vt.huawei.com (unknown [10.67.174.121]) by APP2 (Coremail) with SMTP id Syh0CgCHKUJGdvxovSssBg--.49460S3; Sat, 25 Oct 2025 15:03:49 +0800 (CST) From: Chen Ridong To: longman@redhat.com, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com, chenridong@huawei.com Subject: [PATCH RFC v2 01/22] cpuset: fix isolcpus stay in root when isolated partition changes to root Date: Sat, 25 Oct 2025 06:48:23 +0000 Message-Id: <20251025064844.495525-2-chenridong@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251025064844.495525-1-chenridong@huaweicloud.com> References: <20251025064844.495525-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: 8bit X-CM-TRANSID:Syh0CgCHKUJGdvxovSssBg--.49460S3 X-Coremail-Antispam: 1UD129KBjvJXoW7ZryUWF48ZFy5WF45KrW3KFg_yoW8XryrpF y0ka47Jw4Ygr13C342q3Z29ryFganrJF17Krs8Gr1fXF47X3WvkFyjkws8ta48Xr9xGryj vasI9r4FgasrArUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Kb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14 v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU7qjgUUUUU X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ From: Chen Ridong A bug was detected with the following steps: # cd /sys/fs/cgroup/ # mkdir test # echo 9 > test/cpuset.cpus # echo isolated > test/cpuset.cpus.partition # cat test/cpuset.cpus.partition isolated # cat test/cpuset.cpus 9 # echo root > test/cpuset.cpus.partition # cat test/cpuset.cpus 9 # cat test/cpuset.cpus.partition root CPU 9 was initially listed in the "isolcpus" boot command line parameter. When the partition type is changed from isolated to root, CPU 9 remains in what becomes a valid root partition. This violates the rule that isolcpus can only be assigned to isolated partitions. Fix this by adding a housekeeping conflict check during transitions between root and isolated partitions. Fixes: 4a74e418881f ("cgroup/cpuset: Check partition conflict with housekeeping setup") Signed-off-by: Chen Ridong --- kernel/cgroup/cpuset.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 96104710a649..6af4d80b53c4 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2995,6 +2995,8 @@ static int update_prstate(struct cpuset *cs, int new_prs) * Need to update isolated_cpus. */ isolcpus_updated = true; + if (prstate_housekeeping_conflict(new_prs, cs->effective_xcpus)) + err = PERR_HKEEPING; } else { /* * Switching back to member is always allowed even if it -- 2.34.1