From mboxrd@z Thu Jan 1 00:00:00 1970 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 1684120FAAB; Thu, 25 Dec 2025 09:27:38 +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=1766654862; cv=none; b=osmyFgLkzmipZp63QwLhppt4DGzlFLbuzi0PP6KAZjHj+cFDN8molJWOAXA6/yMPXMRSxH9glXc70GyF+ykUOFDFAg1PnGxoUasYXp3uHBFxEbjy+dBupc2pxpdDIkmCC6wqk1r9hBbGCmXPs9FlwinUlrHJ8uQMIG+zC5EjgbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766654862; c=relaxed/simple; bh=+taLHXJmjbNFlc25nbAGv3mv5ZDJYsfH+2ap2OsnW9k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n/R0NCzYwt5wtyF/xBXZ46HbwZOn7S6Nv79pwh1V1EgEi+xhmkoM66Ykq/ZvJ44mdmzVEJ/Os6pX8RRk7/45t68ncRQpl7bVBQEPW9BPwDVLUrQ+zTIXoxMbBCOdWB3k6zCc7JTXaR0MqMBJfFtVbBxuYWVwOEk9AmS6/7qSMvE= 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.198]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4dcNgR2BdZzKHMNj; Thu, 25 Dec 2025 17:27:15 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 6B95C40574; Thu, 25 Dec 2025 17:27:36 +0800 (CST) Received: from [10.67.111.176] (unknown [10.67.111.176]) by APP4 (Coremail) with SMTP id gCh0CgDHdfaHA01pdDOvBQ--.50478S2; Thu, 25 Dec 2025 17:27:36 +0800 (CST) Message-ID: Date: Thu, 25 Dec 2025 17:27:34 +0800 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: [cgroup/for-6.20 PATCH 1/4] cgroup/cpuset: Streamline rm_siblings_excl_cpus() To: Waiman Long , Tejun Heo , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Shuah Khan Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, Sun Shaojie References: <20251225073056.30789-1-longman@redhat.com> <20251225073056.30789-2-longman@redhat.com> Content-Language: en-US From: Chen Ridong In-Reply-To: <20251225073056.30789-2-longman@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID:gCh0CgDHdfaHA01pdDOvBQ--.50478S2 X-Coremail-Antispam: 1UD129KBjvJXoWxJrWUWFWrtry5GFWfKr45Wrg_yoW8ZrWUpF 1rGay7tFWUtFyUC398tFnFgr9Ygw4kKrnIya1DJw1rJF9xC3W2vr1kJ3ZxXF1UG3yDW3W5 XFZxtrWagFW3Cw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyGb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG 6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV Cjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxkF7I0En4kS14v26r1q6r43MxAIw28IcxkI7VAK I48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7 xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xII jxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw2 0EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x02 67AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU17KsUUUUUU== X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ On 2025/12/25 15:30, Waiman Long wrote: > If exclusive_cpus is set, effective_xcpus must be a subset of > exclusive_cpus. Currently, rm_siblings_excl_cpus() checks both > exclusive_cpus and effective_xcpus connectively. It is simpler > to check only exclusive_cpus if non-empty or just effective_xcpus > otherwise. > > No functional change is expected. > > Signed-off-by: Waiman Long > --- > kernel/cgroup/cpuset.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 221da921b4f9..3d2d28f0fd03 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -1355,23 +1355,24 @@ static int rm_siblings_excl_cpus(struct cpuset *parent, struct cpuset *cs, > int retval = 0; > > if (cpumask_empty(excpus)) > - return retval; > + return 0; > > /* > * Exclude exclusive CPUs from siblings > */ > rcu_read_lock(); > cpuset_for_each_child(sibling, css, parent) { > + struct cpumask *sibling_xcpus; > + > if (sibling == cs) > continue; > > - if (cpumask_intersects(excpus, sibling->exclusive_cpus)) { > - cpumask_andnot(excpus, excpus, sibling->exclusive_cpus); > - retval++; > - continue; > - } > - if (cpumask_intersects(excpus, sibling->effective_xcpus)) { > - cpumask_andnot(excpus, excpus, sibling->effective_xcpus); > + sibling_xcpus = cpumask_empty(sibling->exclusive_cpus) > + ? sibling->effective_xcpus > + : sibling->exclusive_cpus; > + I'm wondering if this is sufficient? sibling_xcpus = sibling->effective_xcpus p(exclusive_cpus = 1) / \ a b(root, exclusive_cpus=1-7, effective_xcpus=1) What the sibling's effective exclusive CPUs actually should be is not CPUs 1-7 but CPU 1. So, do we need to remove CPUs 2-7? > + if (cpumask_intersects(excpus, sibling_xcpus)) { > + cpumask_andnot(excpus, excpus, sibling_xcpus); > retval++; > } > } -- Best regards, Ridong