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.129.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 58900350A09 for ; Thu, 29 Jan 2026 20:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769718178; cv=none; b=mC2DedfHDzC8xcSxnihtGuBXkRsz64rk6BdeMcWz8AFeX0aq4JAzvmNqxL8aDmIMxpCdCc2ULIWr+pZi0/CQOExa/uYr9NQEY7TqxNUt7SjyzDTEMQjILr0SCdEjrjJjBJTWlrbbyasE0bmPCUPh6a7WuYdxSwDtX84AedWPCYw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769718178; c=relaxed/simple; bh=XyFp0JOgCauvJ4z4Et8vDd+xecmpPRSgVTSGhfWz5/k=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=rtOGbINOmV3BocC1DqBN7tumlhdNPWHoCfxo39ZCyKoqTrM61/oUF9GMSBEd8OAv8Z6Eg8LEW2RaxW0ynUU6TtTDgoNuyMsxE0jshO4yN+6IzGPDQhSvRpsO96E33BLLd+G2wlcKjK4ChbGPmikUmLBjvBXydVLisPs5m5gn9Hs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=KMJvP6WU; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=XxYPTUSU; arc=none smtp.client-ip=170.10.129.124 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) header.d=redhat.com header.i=@redhat.com header.b="KMJvP6WU"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="XxYPTUSU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769718176; 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=mS6EZilLlV5QK39B4gmPpvc4B3zDHiCpNJOtvJ8YOrU=; b=KMJvP6WUaxrPMtFB2vdNT60eysytTjDxhUJp+B8dZK+xJXLwABU5u7cT5UiHjq6UVtHNoh 7XmRH6jhJFKdDGhJRLpYY1oXBNZgABxBE8B40SqXrVR9TKB53zFjF7ueUVlWHfn1KgkPS6 VPXMow2YEpS4RsJr6JiG+czuLRBBRaQ= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-HtU0ASKYN46RiEvSgxwtCg-1; Thu, 29 Jan 2026 15:22:55 -0500 X-MC-Unique: HtU0ASKYN46RiEvSgxwtCg-1 X-Mimecast-MFC-AGG-ID: HtU0ASKYN46RiEvSgxwtCg_1769718174 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-89493622b50so23526636d6.1 for ; Thu, 29 Jan 2026 12:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769718174; x=1770322974; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=mS6EZilLlV5QK39B4gmPpvc4B3zDHiCpNJOtvJ8YOrU=; b=XxYPTUSUH241BM/7O4dXHikrCOtTri673a/rQvXu+w5cO3p5SNSBCvXZOJdvTfBBXr +JnEIJ69vF0jjf6TueInHNHR4Y2B3HVIVGpG6pgphpWl8J/ZaU0cCvA069ijhKBxthns /P4L1hMdI7JE/947QaUJ2fOrII5VFfe9PA2lNZweXlKso5HYuT4Wm13CuCdHKJzFafF9 0WFM2SwFDfI943Qh3q5JVvPyHrCR9XbizjQUzqKB4QBuXNo9Rp5ZsGtJNG/Y93DFWGKv 34kyxqRKjaNZXrv2hBpUbAMLQJn/Q255Q6AX0ZX/shZqVdLwsFc38NXSiGeAQMWqlZqc TWFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769718174; x=1770322974; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mS6EZilLlV5QK39B4gmPpvc4B3zDHiCpNJOtvJ8YOrU=; b=xKCFtWrEFEKNtt+GItkR0rcozWpyxYSTK+nvdr89H3Z5FxHNYLtx696IbSa/+20tL3 IinLOblK6Fcg2pvA8PsdJNzQZ/9VWtgAcfptPHtK1KP2oK4WMfKGAN3rMZmi00Bv+nnc u6c97yIjkFeKiBQpTGuaD9OdDGD/ADZFzo3uSbY4bjLHD5ibKieh5wSVshllh3zrGVlB mXpR9n2pYUPeoG2UQlvFCzaQ3SLYUvC0NURbQAl1SpO4VYsUXi4DW9EU1JCGiooxuJ8F 0LIoUuMCCUs4x0j2jvtfDQnJJYaMplM3TKUFzGC0aRsnEF3TN8dhcpIpHMESP01DFl0m jPbw== X-Forwarded-Encrypted: i=1; AJvYcCWSAREJqEmXS1XhRX9pmlB3Ds7h+Sgfh6kL8UHmJH23m63xAjF/urMIIB6n1uiB/FnMLL1zmy/4GTA2Ew8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9UDH7P6gAHqvZaTF5F5IJURly0nQtacChig71OaYpTpix89Lf qw2js8BRxTIH8/nG51Qde5DUW8m8MERl236hY2H0KdO/goF+nU3MVf7v608YnOBd3z+m9f5qpy4 bfBvxdWhG54L9+8o2Ls3CLaFubArPUiXDS/SPxEeTWQkUjaOUyeb2Wcv+VXqKvS3SsQ== X-Gm-Gg: AZuq6aKM6VJHUfl09JG4j2lAu3Izb6dA61cSDQmhyhDXTpReMM+5kO2JmbLKDE2nIp0 hMWlALdZCLC8E7uIKAJZ7ovtYpHC2fB0cSznk9f8L3j08jidp/DJOOtPvdbbHOApcsEnwEh1UMm /5OtK8WGU4xfVmdo5c4F6FNwf1483vAebsEuPi5zHPUXF/fEKqY0iVk5/1HuNOTZZBFeNqpzNe1 FWpQ1jTmDAJDUYeizKr4nGR/nzlEwTzBdWhmvHbX3M3FdYEsDF3zm/WvnxxOER5A1xqUrwH4HkB iIfc+a/S7vdNRGonUbP7ENZ3kTelDhZuic1+az4ljeRfmJ/fbvMTUyMWJZyEkQmkyARo4YrHtNo ga1XSSty5dG/HdvOFVmbpKaJmwlT2SEe2dCMvSzS78lIbEyAvg+qhxtGC X-Received: by 2002:a05:6214:2503:b0:894:8003:3853 with SMTP id 6a1803df08f44-894e9f41fd2mr11287616d6.7.1769718174331; Thu, 29 Jan 2026 12:22:54 -0800 (PST) X-Received: by 2002:a05:6214:2503:b0:894:8003:3853 with SMTP id 6a1803df08f44-894e9f41fd2mr11287316d6.7.1769718173905; Thu, 29 Jan 2026 12:22:53 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d36a5fb1sm44556626d6.9.2026.01.29.12.22.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jan 2026 12:22:53 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <184216d6-9fae-4e73-94b8-ed1d2746a5a5@redhat.com> Date: Thu, 29 Jan 2026 15:22:52 -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 -next] cpuset: fix overlap of partition effective CPUs To: Chen Ridong , tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com References: <20260129064516.210203-1-chenridong@huaweicloud.com> Content-Language: en-US In-Reply-To: <20260129064516.210203-1-chenridong@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/29/26 1:45 AM, Chen Ridong wrote: > From: Chen Ridong > > A warning was detect: > > WARNING: kernel/cgroup/cpuset.c:825 at rebuild_sched_domains_locked > Modules linked in: > CPU: 12 UID: 0 PID: 681 Comm: rmdir 6.19.0-rc6-next-20260121+ > RIP: 0010:rebuild_sched_domains_locked+0x309/0x4b0 > RSP: 0018:ffffc900019bbd28 EFLAGS: 00000202 > RAX: ffff888104413508 RBX: 0000000000000008 RCX: ffff888104413510 > RDX: ffff888109b5f400 RSI: 000000000000ffcf RDI: 0000000000000001 > RBP: 0000000000000002 R08: ffff888104413508 R09: 0000000000000002 > R10: ffff888104413508 R11: 0000000000000001 R12: ffff888104413500 > R13: 0000000000000002 R14: ffffc900019bbd78 R15: 0000000000000000 > FS: 00007fe274b8d740(0000) GS:ffff8881b6b3c000(0000) knlGS: > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00007fe274c98b50 CR3: 00000001047a9000 CR4: 00000000000006f0 > Call Trace: > > update_prstate+0x1c7/0x580 > cpuset_css_killed+0x2f/0x50 > kill_css+0x32/0x180 > cgroup_destroy_locked+0xa7/0x200 > cgroup_rmdir+0x28/0x100 > kernfs_iop_rmdir+0x4c/0x80 > vfs_rmdir+0x12c/0x280 > filename_rmdir+0x19e/0x200 > __x64_sys_rmdir+0x23/0x40 > do_syscall_64+0x6b/0x390 > > It can be reproduced by steps: > > # cd /sys/fs/cgroup/ > # mkdir A1 > # mkdir B1 > # mkdir C1 > # echo 1-3 > A1/cpuset.cpus > # echo root > A1/cpuset.cpus.partition > # echo 3-5 > B1/cpuset.cpus > # echo root > B1/cpuset.cpus.partition > # echo 6 > C1/cpuset.cpus > # echo root > C1/cpuset.cpus.partition > # rmdir A1/ > # rmdir C1/ > > Both A1 and B1 were initially configured with CPU 3, which was exclusively > assigned to A1's partition. When A1 was removed, CPU 3 was returned to the > root pool. However, B1 incorrectly regained access to CPU 3 when > update_cpumasks_hier was triggered during C1's removal, which also updated > sibling configurations. > > The update_sibling_cpumasks function was called to synchronize siblings' > effective CPUs due to changes in their parent's effective CPUs. However, > parent effective CPU changes should not affect partition-effective CPUs. > > To fix this issue, update_cpumasks_hier should only be invoked when the > sibling is not a valid partition in the update_sibling_cpumasks. > > Fixes: 2a3602030d80 ("cgroup/cpuset: Don't invalidate sibling partitions on cpuset.cpus conflict") > Signed-off-by: Chen Ridong > --- > kernel/cgroup/cpuset.c | 19 ++++++------------- > 1 file changed, 6 insertions(+), 13 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index cf67d3524c75..31ba74044155 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -2227,27 +2227,20 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, > * It is possible a change in parent's effective_cpus > * due to a change in a child partition's effective_xcpus will impact > * its siblings even if they do not inherit parent's effective_cpus > - * directly. > + * directly. It should not impact valid partition. > * > * The update_cpumasks_hier() function may sleep. So we have to > * release the RCU read lock before calling it. > */ > rcu_read_lock(); > cpuset_for_each_child(sibling, pos_css, parent) { > - if (sibling == cs) > + if (sibling == cs || is_partition_valid(sibling)) > continue; > - if (!is_partition_valid(sibling)) { > - compute_effective_cpumask(tmp->new_cpus, sibling, > - parent); > - if (cpumask_equal(tmp->new_cpus, sibling->effective_cpus)) > - continue; > - } else if (is_remote_partition(sibling)) { > - /* > - * Change in a sibling cpuset won't affect a remote > - * partition root. > - */ > + > + compute_effective_cpumask(tmp->new_cpus, sibling, > + parent); > + if (cpumask_equal(tmp->new_cpus, sibling->effective_cpus)) > continue; > - } > > if (!css_tryget_online(&sibling->css)) > continue; Thanks for fixing this. Reviewed-by: Waiman Long