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 A4D113E7BCC for ; Thu, 3 Sep 2026 19:12:02 +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=1788462734; cv=none; b=Ts6S9a/i1IG1ykTiC24kPmFqryrPJM0vcOWu4GYxpJTQLSOGR+N+c1l/pAkIzK79YYNRx2dwuaORj+jlZEV4nhd/Dk7JEtKU1SSi8L7kNdR3vMeaSakjB/nv3i8K6Fxjh9oSZV3RR1Poud5U44b9FUMywPK5rwdXSU6xvVkiI6k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788462734; c=relaxed/simple; bh=1i8tMJfp/R8QxhaIUIM0toTZBDt7bMgl455MIL0WIoI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=I+kB/PKiN/xA0IFN/6IgA4Ym8z01BsaDi74j2RatwOE30kohnDNVbmtmBns6+21JpFlCNKRH6jcPuPNPlb6I2wcgofWlfcbNyiXQLkZpcolkvHr86fBMjiReHb0k96Nvu/Z4VWMFrZiMoqTaBTwhh+i/TDdsy4sGyZABB/rRO4I= 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=eUZNJX2d; 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="eUZNJX2d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788462719; 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=9NSPYcZxyhavCYoY5cBlCY/RocvvrkZ0xuo+47WWZcw=; b=eUZNJX2ddC42M0d5LbXwUJYphKVhXXfX4QtHGPA5vALCzQpadcR9D18+JmxwafhsCYG9N8 rF+osiU2p/ICE0pNGE59nCObXtSFZe6cmCjGnnMexkd9CP3C4k/hHQnSrTdtY3465KomHn +ZSx6QsPJFWC0h0csRa2KkgMKYW0mzQ= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-159-enJAFK_rPne1IS8NMIzeYQ-1; Thu, 03 Sep 2026 15:11:54 -0400 X-MC-Unique: enJAFK_rPne1IS8NMIzeYQ-1 X-Mimecast-MFC-AGG-ID: enJAFK_rPne1IS8NMIzeYQ_1788462713 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8309318C0FE8; Thu, 3 Sep 2026 19:11:52 +0000 (UTC) Received: from [100.91.18.181] (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B0671955F7C; Thu, 3 Sep 2026 19:11:50 +0000 (UTC) Message-ID: <9ff85fed-190c-4a8d-8d47-2a37990c1cbb@redhat.com> Date: Thu, 3 Sep 2026 15:11:49 -0400 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/7] cgroup/cpuset: Factor out child partition validation To: Guopeng Zhang , cgroups@vger.kernel.org, ridong.chen@linux.dev Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Guopeng Zhang References: <20260902102615.79189-1-guopeng.zhang@linux.dev> <20260902102615.79189-2-guopeng.zhang@linux.dev> Content-Language: en-US From: Waiman Long In-Reply-To: <20260902102615.79189-2-guopeng.zhang@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 9/2/26 6:26 AM, Guopeng Zhang wrote: > From: Guopeng Zhang > > compute_partition_effective_cpumask() checks whether each valid child > partition remains covered by the parent exclusive CPU mask and whether it > would consume all remaining CPUs of a populated parent. > > Factor these two checks into child_partition_error() so the same rules can > be reused when evaluating a proposed parent configuration. This is a > preparatory refactoring with no intended functional change. > > Signed-off-by: Guopeng Zhang > --- > kernel/cgroup/cpuset.c | 38 +++++++++++++++++++++++++++++--------- > 1 file changed, 29 insertions(+), 9 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 8f24171b6055..6994dc75d940 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -2085,6 +2085,26 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, > return 0; > } > > +/* > + * Return the error that will invalidate a child partition under a proposed > + * parent partition configuration. > + */ > +static enum prs_errcode > +child_partition_error(struct cpuset *child, > + const struct cpumask *partition_cpus, > + const struct cpumask *remaining_cpus, > + bool parent_populated) > +{ > + if (!cpumask_subset(child->effective_xcpus, partition_cpus)) > + return PERR_INVCPUS; > + > + if (parent_populated && > + cpumask_subset(remaining_cpus, child->effective_xcpus)) > + return PERR_NOCPUS; > + > + return PERR_NONE; > +} > + > /** > * compute_partition_effective_cpumask - compute effective_cpus for partition > * @cs: partition root cpuset > @@ -2121,6 +2141,8 @@ static void compute_partition_effective_cpumask(struct cpuset *cs, > > rcu_read_lock(); > cpuset_for_each_child(child, css, cs) { > + enum prs_errcode child_err; > + > if (!is_partition_valid(child)) > continue; > > @@ -2129,15 +2151,13 @@ static void compute_partition_effective_cpumask(struct cpuset *cs, > * partition root. > */ > WARN_ON_ONCE(is_remote_partition(child)); > - WRITE_ONCE(child->prs_err, 0); > - if (!cpumask_subset(child->effective_xcpus, > - cs->effective_xcpus)) Looking at the patch again, I now see that the current code is incorrect. It should be "if (!cpumask_subset(child->effective_xcpus, new_ecpus))" So you only need to pass the "parent_excpus" (for instance) to the new helper instead of passing two. Cheers, Longman