Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795937606; b=YhoRGZwQeBQvkyNik7PkCiNRAL35B2x+8Y7yKXAUTF44UjalSsA6KgqRHkMhKLXjMx50 H2nYfRrO5mwJy8tjmw4v6euQ7zsR+8G5MAGDU5mEp0SHx3VKob7iZSo6plJYchNHt7OjW wTktk38uUrsfhKDxSgo0Up6WRVC0UhueDisuYXTBk7j0/v6nFK4clkKMPCi1qD1q0yOBL Aq9PwuwgLOG7M+UEET4Zmu76hG1wMxVQE58DmA4KvKYwYJfCNRqh0+tdeqJqM0r4ZYPip 9nN8NUgA7nSiHgdLsqwCxeXCMFpd1IBIwVldDJYtZV1sRbfTjyaFxB56RWq/MlrrRSg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795937606; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ni4WCF1/SvQ8rEeBc69/hPMrREWkriqRX0PK57tpWZw=; b=hlugeUTGw0Z+wmrp+KasUx72nD/Eku2Sf/6OoYTnvO4lwOyKD0Oh3TADYKqqR80qyjRI nNIddpVILQjTteMQxB+IdCz3WDvWldr9i/+iF0u2o5F/869zzS8zsOObU1F+uK6ce/HYM ssLU3nQ2QJVQRbAu1qHVwSNyKbSW/HhlJBxL5cZp7M44eJ+jW2eon5+JLepaWWH84DSdn 5i2XymQoB3BdTnxNrhhPbXF+TbmAfQJ8fGC0WARJYDMxJCe6y0hxV5i8Rg3aHEe3MMcFm g7c1Bzt2Tt8WfYHegj86RNB4yJ9R39Ye80i9+e0UI7YGKui6V7jWiVCSP8ChK0jTvyw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aaqNSQZA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2062B606A31C; Sun, 29 Nov 2026 07:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aaqNSQZA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B8DA1F00897; Sun, 29 Nov 2026 07:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795937605; bh=ni4WCF1/SvQ8rEeBc69/hPMrREWkriqRX0PK57tpWZw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=aaqNSQZArES3HvsQCU75ha8r+PHBWvxPyUgPf77deNbGnxj5XSvyFkMnPjQSPTV+j 55bmmqR/HBcmReTxwijrNdLAMSaFKhZ40g5zD14haFGIMT9qHJzlZc0Cn5PUN3CHd5 2OXRXt7fqTtgMf0QfvZCnQmeE9AsgL2GzcAjaY+eLfq90rFFgnlvNDTGf+bQoESCIz 4TOD/zJjWYTTiekPMTy8ZCYNdsSPKS0HRKOh5SPVT9ajeSw+Okp2ERA3P4ZMZGL/Bw DjC5VwtrJx+QNcViUgApk6BSKxECluLeIJA9e/88Ofq/KZYCncF6f80DrBOPO192PB 3kbHfNBIwAflw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v17 03/10] lib/group_cpus: Add group_mask_cpus_evenly() Reply-To: sashiko-reviews@lists.linux.dev To: "Aaron Tomlin" Cc: linux-scsi@vger.kernel.org, virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261129045436.255364-4-atomlin@atomlin.com> References: <20261129045436.255364-1-atomlin@atomlin.com> <20261129045436.255364-4-atomlin@atomlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 07:33:25 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] lib/group_cpus: group_mask_cpus_evenly() duplicates group_cpus_evenly() -- commit ea8c98b46f36bc22b6c75e4130661116efe0e69c Author: Daniel Wagner lib/group_cpus: Add group_mask_cpus_evenly() This commit introduces group_mask_cpus_evenly() to distribute a specific caller-provided CPU mask evenly across groups using a two-stage present and non-present spreading pass. > diff --git a/lib/group_cpus.c b/lib/group_cpus.c > index b8d54398f88a1..75bd082e00bf4 100644 > --- a/lib/group_cpus.c > +++ b/lib/group_cpus.c > @@ -563,3 +563,113 @@ struct cpumask *group_cpus_evenly(unsigned int numg= rps, unsigned int *nummasks) > return masks; > } > EXPORT_SYMBOL_GPL(group_cpus_evenly); > + > +/** > + * group_mask_cpus_evenly - Group all CPUs evenly per NUMA/CPU locality [ ... ] > +struct cpumask *group_mask_cpus_evenly(unsigned int numgrps, > + const struct cpumask *mask, > + unsigned int *nummasks) > +{ > + unsigned int curgrp =3D 0, nr_present =3D 0, nr_others =3D 0; > + cpumask_var_t *node_to_cpumask; > + cpumask_var_t nmsk, local_mask, npresmsk; > + int ret =3D -ENOMEM; > + struct cpumask *masks =3D NULL; [ ... ] > + cpumask_copy(local_mask, mask); > + > + /* > + * Grouping present CPUs first. We intersect the provided mask with > + * cpu_present_mask to ensure that we prioritise physically > + * available CPUs for the initial distribution. > + */ > + cpumask_and(npresmsk, local_mask, cpu_present_mask); > + ret =3D __group_cpus_evenly(curgrp, numgrps, node_to_cpumask, > + npresmsk, nmsk, masks); > + if (ret < 0) > + goto fail_node_to_cpumask; > + nr_present =3D ret; > + > + /* > + * Allocate non-present CPUs starting from the next group to be > + * handled. If the grouping of present CPUs already exhausted the > + * group space, assign the non-present CPUs to the already > + * allocated out groups. > + */ > + if (nr_present >=3D numgrps) > + curgrp =3D 0; > + else > + curgrp =3D nr_present; > + cpumask_andnot(npresmsk, local_mask, npresmsk); > + ret =3D __group_cpus_evenly(curgrp, numgrps, node_to_cpumask, > + npresmsk, nmsk, masks); > + if (ret >=3D 0) > + nr_others =3D ret; [Severity: Low] Could group_cpus_evenly() simply call group_mask_cpus_evenly(numgrps, cpu_possible_mask, nummasks) instead of duplicating the allocation, two-stage spreading, and cleanup logic? Since cpu_present_mask is a subset of cpu_possible_mask, passing cpu_possible_mask as mask produces the same two-stage distribution. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129045436.2553= 64-1-atomlin@atomlin.com?part=3D3