From nobody Mon Feb 9 19:26:32 2026 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0461F1E0E0F for ; Tue, 28 Jan 2025 16:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738082824; cv=none; b=qxWheGWx2lN6yHm7h3JMBN3v8+N5Qw+5Crcq01AHWHUNOBpV8cWkWV3CjeI29kzmDAC55XLxepasHBM14D01ha8JcK6VFo1w+3/XhvDR81opz0K8TFlymwoYTXTdjAMl82gA3+gweVXbi5dIMr2VeNLoiAOiwVr/KFxsTXr3Ovs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738082824; c=relaxed/simple; bh=ng5dEXmuKD7yyNEENQHhP9qfrE41NdaQ4jo47P1Sx2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oN3bLkLKEEJgLUcKFt47lTUDPlo02g1RpxRfy2ZhatxJcSwTu7DFlLG1KDQcd3HR3q8h9iWFF+jly1NQEKnMcdsB+mgKAHfot81J8iDmASAIfWL65QO8mJuJyR52CQJmdSjGZ2dQ7RRJ09UCQ49Js4f/WKRkQJ33OyshzjVwfDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Me8oludV; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Me8oludV" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e54bd61e793so9931524276.2 for ; Tue, 28 Jan 2025 08:47:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738082822; x=1738687622; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l7976T2mPCTdZIY1BKxms9DlxI8DO4T1ITHA6MvqiMY=; b=Me8oludVOunrgs/BP8kh6KVLdmg8cWctY86t8/5J0en3wr/XfNMNtkrv9eom6IRNAa l3oQzBOxLKJ3qvYIVwPg7yPXb31Zi1m4Vs8Z6K59mVNXeEdIOAoaz8OvxSVqKD88x1IP 6uYEdmtPk0DYXiOM3uWEQUXGFNqNH/9DXp5G2s+AF6MHfWl4zC32/7c3tESDmI3L2BvU Sk7OBDdsdOBjVHSOYo5XFOyBhbOJvyIj7FPEexS1uYWCsPZricvmUsn4NFMWZ5PTo+GN zdM+8FDRKsPLNGLqF+YWVOMOtMFJ8wtDV+vrTWWA94lc1LqbYIf1l98CTx+E48ulxLxh qdYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738082822; x=1738687622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l7976T2mPCTdZIY1BKxms9DlxI8DO4T1ITHA6MvqiMY=; b=GXuxxskbYLlT8tforhN5mYAv9Z/Y6o2cjMnNO1mEY1VfWLaZmsCagb7zUcdng1wE59 QBBI3Ns2tZA7/uqsiU91nhQBhq1ACVX9OmUZs+/3h4TjkoIWbvCi4vUm1IotH2RqNJSr 4WlupA8evYB0wqZDOC8ffnJDHVISRm72rN1BUOrvvgjkdZzTEKZ3G7i5ybsMjBk35pTh oBR5K9zZXH/PHMSwGimvtluFopjT6Qc6ZubudWaHez5S2KvHl8kLcHqiS4cvllcadUbf 0oqNCrdqwQJejMM/JQKUVIUhqrG6Z5oPAN9HDShbN6t6FMqXCd+fBqaDd0J/HJwb7k+S mKbg== X-Gm-Message-State: AOJu0Yy+M/FF2kLvkxe5ZEgOdLNstBUonhf8c655ltcALiI4EAkD7Af2 nLLdYpHqyXkrAFd3ShkCGGDxAL0yMfIC5Ub9lUdcDEYrvITkh4ZXO3t7h5dj X-Gm-Gg: ASbGnctOHHdjMDGXqrz1xa7Q78Frb7qoEQQS3CLYVIBmAeBuzDwW1LuxQUzCXg/zOwM +K54lFzKR+xvdkEa/82rj9ICPCoCXOQqd3LGPgnwg7sLPtwDm5nlI+S/zcvrwkO71dEo4kU1sEJ h/n30oqu4P+ubNZ+0RhrzuxvmKxv7ulJ9DACrI/ldrfHRkl0Xa2ClAMcknHkYTiM2XkmaaFSDOC 0+oM1CRsDkEzZVxNFdemCAY7ms+nGGZGtnzRAkj/IAfu3R4hJgCSaLCXIwlf2Gcgkr/f4q472gv 3E2psOop1s2z+GCA2nx//VvDiOW3pWOOolBrA7qTbDYTkisZ5vs= X-Google-Smtp-Source: AGHT+IEsbhBMPGmyQ+wCfEyuY3u5J2qhcD7NxaA5xwum7sJWnsZHBq6QOeqHCBWtmPPisttFrxZsjw== X-Received: by 2002:a05:690c:600b:b0:6ef:6d61:c254 with SMTP id 00721157ae682-6f6eb9475e3mr314307577b3.38.1738082822059; Tue, 28 Jan 2025 08:47:02 -0800 (PST) Received: from localhost (c-73-224-175-84.hsd1.fl.comcast.net. [73.224.175.84]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f7578a23d4sm19395877b3.54.2025.01.28.08.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 08:47:01 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, Yury Norov , Rasmus Villemoes , Andrew Morton Cc: Christoph Hellwig Subject: [PATCH v2 07/13] cpumask: use cpumask_next_wrap() where appropriate Date: Tue, 28 Jan 2025 11:46:36 -0500 Message-ID: <20250128164646.4009-8-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250128164646.4009-1-yury.norov@gmail.com> References: <20250128164646.4009-1-yury.norov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that cpumask_next{_and}_wrap() is wired to generic find_next_bit_wrap(), we can use it in cpumask_any{_and}_distribute(). This automatically makes the cpumask_*_distribute() functions to use small_cpumask_bits instead of nr_cpumask_bits, which itself is a good optimization. Signed-off-by: Yury Norov --- lib/cpumask.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/cpumask.c b/lib/cpumask.c index c9a9b451772a..d7cce2aaebc2 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -174,8 +174,7 @@ unsigned int cpumask_any_and_distribute(const struct cp= umask *src1p, /* NOTE: our first selection will skip 0. */ prev =3D __this_cpu_read(distribute_cpu_mask_prev); =20 - next =3D find_next_and_bit_wrap(cpumask_bits(src1p), cpumask_bits(src2p), - nr_cpumask_bits, prev + 1); + next =3D cpumask_next_and_wrap(prev, src1p, src2p); if (next < nr_cpu_ids) __this_cpu_write(distribute_cpu_mask_prev, next); =20 @@ -195,7 +194,7 @@ unsigned int cpumask_any_distribute(const struct cpumas= k *srcp) =20 /* NOTE: our first selection will skip 0. */ prev =3D __this_cpu_read(distribute_cpu_mask_prev); - next =3D find_next_bit_wrap(cpumask_bits(srcp), nr_cpumask_bits, prev + 1= ); + next =3D cpumask_next_wrap(prev, srcp); if (next < nr_cpu_ids) __this_cpu_write(distribute_cpu_mask_prev, next); =20 --=20 2.43.0