From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792639423; b=i4Kd4VJvPW6l5KaaFGjrCY2oIvpWC+k9s05lqXuzQRifdFLYjK9ko03cURtXdNK1YJZC XQyr3CHqXavsfoy5X7Cr2sFyNyVskajfv0czXu/5BYoP/u59bj13prBeex2eh3hgMlwa+ MJmxyocnfw0IbybdchVmb21W0lTPAG7/ovfw6UaYKLs8yxpcKMfMCESyAxyLxwsXKDh8B P4pvHSSvTUk7QF3vq/45Nj1md+QeiIscdOaatoFS35Kv/1BdQTvdsHFJohDMZ/clooFig LQY/247/g+AiQphDUufnkf3kRHHbuWH94JgXdqX4W9PuAUOVcyk8VszbmBUYHeCt+hg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792639423; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Scanned-By; bh=Ccyz5/U4JdhiN3TobyhIUaa9LmfIlsxj9S6/np5ABxU=; b=hBiKQenqOZ/vU2bzNtSPY4E9IjPfrjkxV7GSz8JIeAdFH9uCz1+WsNFJ8+uc7RZxSn6I qHe+LKQ+ATF2erswZX/H7Wkmb1V2IB9kjjhCdlZepCbC7TjxwzBTmeb2lyo+ALNtw1cx/ 7rj8+HXjnse2pUpPhFaoLH4L0H3kZwC0+5iXxgfAryWtOaHsBLqCQ7Xz49mW45AxXZ5+g l4m1LJ0L2VsLiio0o6gofW9wmgVjBJmkqQok5Lg41QGqCJhEbUc0vr+efZEwqG+aOvogt LhyuAE3h0OeE2nfz2XhGRuq7GCu2MBt6HMwG5kknQxcEbJ87zhXoeg/cnB98A2l5f6w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CrAse3aM; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1A14606A319 for ; Thu, 22 Oct 2026 03:23:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D1A14606A319 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CrAse3aM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792639421; 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=Ccyz5/U4JdhiN3TobyhIUaa9LmfIlsxj9S6/np5ABxU=; b=CrAse3aMqr0CL0XoedKmgzcbO/Timzijac+KcuJ8mgrBnpW30aY8fjuRgkdnsLLR3BWHyi jGNcyqRDKKxeVuRnI/nxX4LJKUtgE9KsSgn69ujHsXsjDhrwb2IK/MDXBj5OSoS0YTjPnb sG5HOWenwiMXDUWZaI/993H6ik+AHDs= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-182-GG9IS55XOyi__AyypsRQnA-1; Wed, 21 Oct 2026 23:23:14 -0400 X-MC-Unique: GG9IS55XOyi__AyypsRQnA-1 X-Mimecast-MFC-AGG-ID: GG9IS55XOyi__AyypsRQnA_1792639393 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF24F19560B2; Thu, 22 Oct 2026 03:23:12 +0000 (UTC) Received: from [100.91.18.181] (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 350B31800480; Thu, 22 Oct 2026 03:23:11 +0000 (UTC) Message-ID: <0514f986-c125-4a2a-8079-cbbfe5cdc273@redhat.com> Date: Wed, 21 Oct 2026 23:23:10 -0400 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] cgroup/cpuset: Fix cpuset.cpus update in a remote partition To: Guopeng Zhang , Tejun Heo , Ridong Chen Cc: Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Guopeng Zhang References: <20261010075947.333549-1-guopeng.zhang@linux.dev> <20261010075947.333549-2-guopeng.zhang@linux.dev> Content-Language: en-US From: Waiman Long In-Reply-To: <20261010075947.333549-2-guopeng.zhang@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 On 10/10/26 3:59 AM, Guopeng Zhang wrote: > From: Guopeng Zhang > > When the CPU list of a remote partition is reduced, a removed CPU may > remain unavailable to the top cpuset. > > This can be reproduced on a cgroup v2 system with CPUs 0-7 online: > > cd /sys/fs/cgroup > echo +cpuset > cgroup.subtree_control > mkdir A > echo 1-7 > A/cpuset.cpus > echo 1-7 > A/cpuset.cpus.exclusive > echo +cpuset > A/cgroup.subtree_control > mkdir A/B > echo 1-4 > A/B/cpuset.cpus > echo root > A/B/cpuset.cpus.partition > echo 1-3 > A/B/cpuset.cpus > cat cpuset.cpus.effective > > The last command should show 0,4-7, but CPU 4 is missing. > > update_cpumask() calls partition_cpus_change() while cs->cpus_allowed > still contains the old mask. remote_cpus_update() first releases CPU 4, > but the hierarchy update revisits B and compute_excpus() still sees the > old mask, so CPU 4 is removed from the top cpuset again. > > Move the cpus_allowed update before partition_cpus_change() so that > the hierarchy update sees the new mask when it revisits the cpuset. > > Fixes: f62a5d39368e ("cgroup/cpuset: Remove remote_partition_check() & make update_cpumasks_hier() handle remote partition") > Signed-off-by: Guopeng Zhang > --- > kernel/cgroup/cpuset.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 0ebba2d646c3..de7553459adc 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -2478,10 +2478,13 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, > */ > force = !cpumask_equal(cs->effective_xcpus, trialcs->effective_xcpus); > > + spin_lock_irq(&callback_lock); > + cpumask_copy(cs->cpus_allowed, trialcs->cpus_allowed); > + spin_unlock_irq(&callback_lock); > + > partition_cpus_change(cs, trialcs, &tmp); > > spin_lock_irq(&callback_lock); > - cpumask_copy(cs->cpus_allowed, trialcs->cpus_allowed); > cpumask_copy(cs->effective_xcpus, trialcs->effective_xcpus); > if ((old_prs > 0) && !is_partition_valid(cs)) > reset_partition_data(cs); Sorry for the late reply. Thanks for reporting this problem. I suspect similar problem may exist with change to cpuset.cpus.exclusive as well. The root cause of this problem is the recursive call to remote_cpus_update() with the second call missing information leading to the revert of the first call. I have posted another patch to address this recursive call problem. Please take a look to see if you agree with that or not. Thanks, Longman