From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (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 BDD33198E77 for ; Sat, 28 Dec 2024 18:49:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411800; cv=none; b=TI/0oHfSRijrMhNwf9QEQ+jBJKL6VjWGaKd5dGwk/qZDU5BMRTCcsd3/05TC0KKhl4pdLHB7NbuTkY5iiN6qJvKl8h27HvbJpVpxTYeec3UdvqIGYv3OV7jp1Aiw5iQfUhnFxlRwlclJlQQb6O54AaSbe1GIwlCZRnttJVOLRdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411800; c=relaxed/simple; bh=+Zwsfy6YH5CS10fTclDUEdCV+0IQUSu1rzL9TeANRqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JeSfcwNjm62Qh8U2WWm/0hkdvFCZazZr2su1wqMqjaBJPyAB2VRtpFe33Ql4LmQ2tYKE4vFYYx+SL4wOw/F393taaSBFE10jJJJTQBpRgydmmc3DmqjOiwjEFWQNgH0MhvDsKNVmfeYpOJi2sNwNt2olCI5tdcdcDisinLQSkzM= 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=W/mhpudH; arc=none smtp.client-ip=209.85.219.181 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="W/mhpudH" Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-e3f78f5fc07so7668654276.2 for ; Sat, 28 Dec 2024 10:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411798; x=1736016598; 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=ubvhjam4awIBMi5vwHaqj7zTIr7vOK16Tu3+fo0j/yY=; b=W/mhpudHY5BJ+Vv4OsRpSfdcI9DyhxiNAX/xzJ+Dx4/qQG2E3mrQIs4Ep2huTwrekg pHCQdZpOBO9gIUeDR/dG9ev6kICh7Tut5hKSmK59AiJFL7Oe2v8rz7WkbJgBnTJ2Xr5P 67AIjCEU+8URoqOd0/Wz+gQTCAzHbUMXrVhBOZvxFXoQ74FbtMf7srhzAkv+lgOmztfi 0t0hXAkldwd2/qgDUGVr0TgbZ1veb6zbKX6SKOT+fnrr6eXfN3z3xXrHckkvRaMcoTG8 3VbKOmu2sb0QwvXkd1KgONjbUmTocoxegnIvxP1nrl1CZI108N920G69iMPSW8SScjGj ZPRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411798; x=1736016598; 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=ubvhjam4awIBMi5vwHaqj7zTIr7vOK16Tu3+fo0j/yY=; b=U//rhXzEgCn/eZQyMit/AO9NQIGNi3+n5TOZLq7wyJCnFvMVbYRKcCJWY4fiewwXrD /jAN4HMo/gnWAEF2cikCnhbTiVQrRIllXRyStpi3RVPOy5gYKNFlP7rdgyrQXLli/Sbo fNsTdlO4shMqxwjbQUHq4c4m1dQQOUPlw26NJhoekeGmfLMqHwchdAdiph07vQpEXAD7 8vOKBOsq6n6ng1mz6S6+Eu3oybXtqQhuiWT1mmLQWQOQKzrLpceQdFzit1y48DC09xeA MCrniVjUkwj4zDEfzXMNs9wnaMDPiNmHv5XuEUtbgX3kboUIlV/tzuzkAimmKht8ck5W vD3w== X-Gm-Message-State: AOJu0Yy1CI3sUsKD8SChFi5p5VTBcol3IoYDy9IoP5MJzKR0ocL6iCQz tezLk/TKDMVBvB/g+RLeL8SfNDglbCOBg1jUqekbV4jh3IPw/yzjdX5zlEPc X-Gm-Gg: ASbGnctu1jM4wxBci/bnj3TgZFvdPGixoYaGcDU+3qRYRHq1L+bhZTAR7TmgK0KaGJW LBR1tHjvFxbIjlsFB+/IUf+Qb+HIWE1S7LohUHeP2pMxuMCUloBzXBqb060bBx8+TYf7ykrV8B9 MdDhf0pXRxPakXtz9f6sgMKwkL3wx/N+uXfYmUFVa2lepBBBCCmhsvflxVAkJBwF9CsIGCupL+R Erv2r4JeZaGwxYyRtL0UNjz+OIKt8k81b02qsEVAPHKvh6hxHf6N+UjRPOwrwwEXIw1rz+CPBWc 32R7kt2+3v/IGd/P X-Google-Smtp-Source: AGHT+IFOOrRjg39+N/+YbDIKjS25mXKDV3xCERSc4aweH33rlFnOKc3HKrVsOs1V9UwfUjO4oOeNyw== X-Received: by 2002:a05:690c:7203:b0:6f0:21d6:449a with SMTP id 00721157ae682-6f3f80e60a1mr233362847b3.6.1735411796540; Sat, 28 Dec 2024 10:49:56 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f3e77ee159sm48206467b3.87.2024.12.28.10.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:49:55 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, Matt Wu Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 01/14] objpool: rework objpool_pop() Date: Sat, 28 Dec 2024 10:49:33 -0800 Message-ID: <20241228184949.31582-2-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" The function has to track number of iterations to prevent an infinite loop. for_each_cpu_wrap() macro takes care of it, which simplifies user code. Similarly to for_each_possible_cpu() flavor, this patch introduces for_each_possible_cpu_wrap() version of iterator to keep usage of the API simple and coherent. Signed-off-by: Yury Norov --- include/linux/cpumask.h | 6 ++++++ include/linux/objpool.h | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 9278a50d514f..5cf69a110c1c 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -1033,11 +1033,17 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); #define for_each_possible_cpu(cpu) for ((cpu) =3D 0; (cpu) < 1; (cpu)++) #define for_each_online_cpu(cpu) for ((cpu) =3D 0; (cpu) < 1; (cpu)++) #define for_each_present_cpu(cpu) for ((cpu) =3D 0; (cpu) < 1; (cpu)++) + +#define for_each_possible_cpu_wrap(cpu, start) \ + for ((void)(start), (cpu) =3D 0; (cpu) < 1; (cpu)++) #else #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) #define for_each_enabled_cpu(cpu) for_each_cpu((cpu), cpu_enabled_mask) #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) + +#define for_each_possible_cpu_wrap(cpu, start) \ + for_each_cpu_wrap((cpu), cpu_possible_mask, (start)) #endif =20 /* Wrappers for arch boot code to manipulate normally-constant masks */ diff --git a/include/linux/objpool.h b/include/linux/objpool.h index cb1758eaa2d3..b713a1fe7521 100644 --- a/include/linux/objpool.h +++ b/include/linux/objpool.h @@ -170,17 +170,16 @@ static inline void *objpool_pop(struct objpool_head *= pool) { void *obj =3D NULL; unsigned long flags; - int i, cpu; + int start, cpu; =20 /* disable local irq to avoid preemption & interruption */ raw_local_irq_save(flags); =20 - cpu =3D raw_smp_processor_id(); - for (i =3D 0; i < pool->nr_possible_cpus; i++) { + start =3D raw_smp_processor_id(); + for_each_possible_cpu_wrap(cpu, start) { obj =3D __objpool_try_get_slot(pool, cpu); if (obj) break; - cpu =3D cpumask_next_wrap(cpu, cpu_possible_mask, -1, 1); } raw_local_irq_restore(flags); =20 --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 ED75D198E80; Sat, 28 Dec 2024 18:49:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411800; cv=none; b=ungicrXBIaCrBHkBPK5uPaApfudLpm0dURSQR6uqr9KiQBUlrhg7XFYVmqPct82OwP02xwOqs+Zr67OfavULvmg/xIRaNGk3aCwGmUGtAcoNFWkVIqEF7k89oN4BYDmxS13oTfQR41o48KzES4/U0vhXXHr9dxD+84ryaKa7gcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411800; c=relaxed/simple; bh=rjLiHSvKUq/eF1loio7Yr9yGD09W83hpAJm71ZhEPPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=adjKImLt9iZkFIEC7asea1zInp5AJTFzWyp+/wi1GYZ7MRzmNWreTZ5GBCC/psxEV/98r03ELCHt2ut1sVacV6142nxg5nAnZkMJdB16+rUiigR+M8Jz8q5QRqlTTJeeWhtUAXuD2MAhiVLqZqwOQOdVZIuAd0eFbfsZEFL/HYE= 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=Ie3EDXK8; arc=none smtp.client-ip=209.85.219.174 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="Ie3EDXK8" Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e479e529ebcso8993600276.3; Sat, 28 Dec 2024 10:49:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411798; x=1736016598; 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=ZyD/SfnxslLrliyoyVIe5C8rt51G8jW8D1jt5/B6HkA=; b=Ie3EDXK8YB+0UqQFBuZBg36/iBJPsGE76Dk8BCK5qmiwpIWJ37JfKFOgie4mvkQMrZ 5Fh9uW6GjDeHLa902qDMlm1qflbhGpcQshpBSdK/tEyUxzKPq3DuCS95BlB78MqmXYcy ZKw/Qw1ZR4nT/tj+EglcUAExuecgV4enDupqCrNr3bsqqZL8qE/nOK4zebGkgpLUVOEL QzHHrfyIJ/Jx8WoJ/CitKmHQU0Ehz1T2mG5UM3tXtI3YB8FNVUnxs5DYnmQgP+VHxXAJ KqGIU2/WcPXkiLCEZiUiE24PUDpQb3XayVbZLDBiFGIh6cRpXh4xBmnz+6sU3h7dZVGH +t9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411798; x=1736016598; 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=ZyD/SfnxslLrliyoyVIe5C8rt51G8jW8D1jt5/B6HkA=; b=tW24j5svFOOq7OCFvOGBW1K122raCaivuZlbSlP8gVIpgz3AyMSHH8OkTpg4iVRAXp 6mGLM86Bllp+O2OIWWdHpX5DUbzNUX6Dk4lAMrVJ69/iYAUXbkq3VywN3lrNB09QSLzv qY42MmL2qT5ZPIXU5zqhiRansd8nbgLxbZDQOz6a5OSuXPpWSgQK6J/ZcnO66lCW+7jc 35asGOyagfwgxED2DN3Go3QR/NvCP7tAD3GLSI1nvCB//SannJGoWwdrcJecwWdfhiJR tzyNyMh7QzVjfc8/zC7UWiyDCLRJaj5qphIggYyRRhXYYWgOYn0c8fL0BTADIVwomNlk eJ6Q== X-Forwarded-Encrypted: i=1; AJvYcCUFGJ7G+52QkbWjmebddEPQXNQsKB0/w1clOeervJeazOEeR8kvClQf7WVElD8d6kUckKifxE4=@vger.kernel.org X-Gm-Message-State: AOJu0YxUxlAq4UOGgtD0uq83GEA0X/CFgPniRAKWei1YETlEOMXs5zkD QcA7m/yi3gBspD/GB3sAA6TNmMIWsUyJJKax3FoEyeFh131m0PNokPyNDniQ X-Gm-Gg: ASbGncv5oSutyQX3lWHmmjDTCTSB/6AJMYbs+HoNfAYKsy8U1xDHIl7VvxaVQVnIpRJ CVzYM7wOStsDpkF1iS0XaxuNbciBtI3CuTti3D8vI4mk0cZzIYpyH1IMDZ2oFmheQag3CohulxU gjNxhflmiTnMl3//Oukj+wjQZb1Z3erWyddve6eqzfN7Gbbdr1zhrLZY1M6uOSib1sIJZfLM0nR V4A9LEkjnB6suO6NGNWDh5brFafBf2vMtKNbzCw6Axdif6T/t0yYp4++mBU0s6qFNIUBTc48VAc Zgm54JJi1aCuqbbl X-Google-Smtp-Source: AGHT+IGiqvJf1RliBJCBp61gtA5mmGJsJtIiqDmDHZDVegn/DpktFuOcGR3eHMQYzJgC1Tq1ntdg3A== X-Received: by 2002:a05:690c:6c08:b0:6ef:4a57:fc7c with SMTP id 00721157ae682-6f3f8115430mr229828487b3.16.1735411797858; Sat, 28 Dec 2024 10:49:57 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f3e77ed1fdsm48567247b3.84.2024.12.28.10.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:49:57 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, virtualization@lists.linux.dev, "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 02/14] virtio_net: simplify virtnet_set_affinity() Date: Sat, 28 Dec 2024 10:49:34 -0800 Message-ID: <20241228184949.31582-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" The inner loop may be replaced with the dedicated for_each_online_cpu_wrap. It helps to avoid setting the same bits in the @mask more than once, in case of group_size is greater than number of online CPUs. Signed-off-by: Yury Norov --- drivers/net/virtio_net.c | 12 +++++++----- include/linux/cpumask.h | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7646ddd9bef7..5e266486de1f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3826,7 +3826,7 @@ static void virtnet_set_affinity(struct virtnet_info = *vi) cpumask_var_t mask; int stragglers; int group_size; - int i, j, cpu; + int i, start =3D 0, cpu; int num_cpu; int stride; =20 @@ -3840,16 +3840,18 @@ static void virtnet_set_affinity(struct virtnet_inf= o *vi) stragglers =3D num_cpu >=3D vi->curr_queue_pairs ? num_cpu % vi->curr_queue_pairs : 0; - cpu =3D cpumask_first(cpu_online_mask); =20 for (i =3D 0; i < vi->curr_queue_pairs; i++) { group_size =3D stride + (i < stragglers ? 1 : 0); =20 - for (j =3D 0; j < group_size; j++) { + for_each_online_cpu_wrap(cpu, start) { + if (!group_size--) + break; cpumask_set_cpu(cpu, mask); - cpu =3D cpumask_next_wrap(cpu, cpu_online_mask, - nr_cpu_ids, false); } + + start =3D cpu < nr_cpu_ids ? cpu + 1 : start; + virtqueue_set_affinity(vi->rq[i].vq, mask); virtqueue_set_affinity(vi->sq[i].vq, mask); __netif_set_xps_queue(vi->dev, cpumask_bits(mask), i, XPS_CPUS); diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 5cf69a110c1c..30042351f15f 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -1036,6 +1036,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); =20 #define for_each_possible_cpu_wrap(cpu, start) \ for ((void)(start), (cpu) =3D 0; (cpu) < 1; (cpu)++) +#define for_each_online_cpu_wrap(cpu, start) \ + for ((void)(start), (cpu) =3D 0; (cpu) < 1; (cpu)++) #else #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) @@ -1044,6 +1046,8 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); =20 #define for_each_possible_cpu_wrap(cpu, start) \ for_each_cpu_wrap((cpu), cpu_possible_mask, (start)) +#define for_each_online_cpu_wrap(cpu, start) \ + for_each_cpu_wrap((cpu), cpu_online_mask, (start)) #endif =20 /* Wrappers for arch boot code to manipulate normally-constant masks */ --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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 350D31990BD; Sat, 28 Dec 2024 18:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411801; cv=none; b=uoN9FLf74Pv+zOUsT9+kM7Q7vGVJsIVrFqQAq2s0E+yOa0ouX0lfwc0EFPsCgUUNnYrBG+Gl64m0oWXmJ1vJ4G0YI/Cb72GOVGVURTSEQb3u2lFqCPmW8MyA0Ztg3mZRIBwDI3QXky6MArdgFeIrHbHRaqLbyRCgNQ9/3gvSXRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411801; c=relaxed/simple; bh=LKBBs7f6TPE3UEfobjTvbZ289SCsfoAg3ya4QFyqHdU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sDYWSn4eyTTWBaDxaMHI2hmi2xbAh9S/rL+ktbDrRmavYsHM0RD7YiouAeznH1n4SGEsTerJ9SsaynlGr05Mpk/qMAa2nGStZ290h4AD6XGyhxeeAt1Obntc/IrPRUVM8nGTQwn3lgWc8FE+MMESSUxB/bJhUG2Twx4UGiLxnmM= 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=Qglg4mgi; arc=none smtp.client-ip=209.85.219.182 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="Qglg4mgi" Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e4a6b978283so10107378276.0; Sat, 28 Dec 2024 10:50:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411799; x=1736016599; 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=lL8rNecoxrOgRuhpm+UkLZuLqFEtoRoNCimf/pNjqjs=; b=Qglg4mgix2Id8tX4dKCb+WINfyhD5fU0AfeshymC9M8+DN4k4DXSiUp1sfjz4Ojex+ 9GE2g2Hm5c/61z1R4tBUGVG0g+fITY/CQUW6lT1Ti+aWhK/2Hlz3ZM2+fzSj0ulkLic+ ZM4UfVwzNXSSrB3aZi4yqnHh8YfhOujdeClcKASConwY2csdgpVp93OQBPM7vxirnPix AMcvThYX+oM4FuDLSlXiYNkhvylJV9q64b7gW4A6Qk/poNFFzEw29pGC3AIz8juBUDA8 nbhwU9p2aMF2LZanF/K+yuv/LnL/vrsTCfnX7nHKpQTBYojxaZB+UdWj2ngxOcdQ53TL FE7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411799; x=1736016599; 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=lL8rNecoxrOgRuhpm+UkLZuLqFEtoRoNCimf/pNjqjs=; b=hqzJob6YJsU+AmzWxjVU3O6RLJUBrv+12gTTTt6LYNGytlJCiGjulynsVhDZPKQepA BXcUW6Ose8Jsun+44wRSYxcunCWMJywomwYpkD0qGgdIuygILRtmtbZTYxH+CzuOcHKA k7CZgvNJp4WpbAo9C317FzgVjejrIau2cqWfTeY+cg6RqPVwH+Wt+wovLKSisWuKwdSZ 3YCjIlDdxepRolSu9MmtqBIZcBFG38ncTfTccqK04mVdv0OiKu8hjxjkMrvhs8jU5oEY 9MLxvEBfAotnCO2TE93nDEV/wxWsPqHu241o6XXdIyEquhIiJ2IfVfFyceL4dpT2URrh zn+A== X-Forwarded-Encrypted: i=1; AJvYcCWRFpBwXlG06UUVDdzncjqQqk0VM7QIeUgFOE93lT45XbqlBvIU5USoS7CYYdavZKVlZycQpYI=@vger.kernel.org X-Gm-Message-State: AOJu0Ywne3BMIer3SomRnsnmaHBKh53jOt0+4p2lBCo+ySORDdz4mJ3I jqzxLzhkxXkEQNSQUwfltIAbbFg3oWR36KT1+eXzVclkR/bL41HmfAbi3Q8u X-Gm-Gg: ASbGncvu86a9n5+PfE6Y0vYS4ifUeumMEFRVb50kN5r/lgG3aj/m7gcLvGdlxdh7mXL HEzPrkEfI1rJjgzfBIHYW8sm548DZO8OiC5LiXmj2qT10ILdawmSFEIT47fK5JJRq0BW5C9LddX zkD4jC7QpTObA/6RFQIJtidy9g6JSzViYAmXEXNgDI6i7h9m4dOPenHOWVSX1vHHoKrN/Y6fXb8 6J2KSf0bLf2Ik/NsktHNvl0KsSpXKFmCDPVxko4MteZnGx6FROBUPhVkot+yanT0Nf7StOhBjd4 W9VpM1+lHUpyFWH7 X-Google-Smtp-Source: AGHT+IGzd+E2S8x2gXxoaCvAStSmkZ51igXj24qQWSN3ZW4n/H7SUeu2mKOPhIyoM4H12slkJ1LXvQ== X-Received: by 2002:a05:690c:4a0a:b0:6ee:5104:f43a with SMTP id 00721157ae682-6f3e2b8aeffmr257339587b3.20.1735411799162; Sat, 28 Dec 2024 10:49:59 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f3e71a8d26sm47945657b3.0.2024.12.28.10.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:49:58 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Haren Myneni , Rick Lindsley , Nick Child , Thomas Falcon , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 03/14] ibmvnic: simplify ibmvnic_set_queue_affinity() Date: Sat, 28 Dec 2024 10:49:35 -0800 Message-ID: <20241228184949.31582-4-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" A loop based on cpumask_next_wrap() opencodes the dedicated macro for_each_online_cpu_wrap(). Using the macro allows to avoid setting bits affinity mask more than once when stride >=3D num_online_cpus. This also helps to drop cpumask handling code in the caller function. Signed-off-by: Yury Norov --- drivers/net/ethernet/ibm/ibmvnic.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/= ibmvnic.c index e95ae0d39948..4cfd90fb206b 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -234,11 +234,16 @@ static int ibmvnic_set_queue_affinity(struct ibmvnic_= sub_crq_queue *queue, (*stragglers)--; } /* atomic write is safer than writing bit by bit directly */ - for (i =3D 0; i < stride; i++) { - cpumask_set_cpu(*cpu, mask); - *cpu =3D cpumask_next_wrap(*cpu, cpu_online_mask, - nr_cpu_ids, false); + for_each_online_cpu_wrap(i, *cpu) { + if (!stride--) + break; + cpumask_set_cpu(i, mask); } + + /* For the next queue we start from the first unused CPU in this queue */ + if (i < nr_cpu_ids) + *cpu =3D i + 1; + /* set queue affinity mask */ cpumask_copy(queue->affinity_mask, mask); rc =3D irq_set_affinity_and_hint(queue->irq, queue->affinity_mask); @@ -256,7 +261,7 @@ static void ibmvnic_set_affinity(struct ibmvnic_adapter= *adapter) int num_rxqs =3D adapter->num_active_rx_scrqs, i_rxqs =3D 0; int num_txqs =3D adapter->num_active_tx_scrqs, i_txqs =3D 0; int total_queues, stride, stragglers, i; - unsigned int num_cpu, cpu; + unsigned int num_cpu, cpu =3D 0; bool is_rx_queue; int rc =3D 0; =20 @@ -274,8 +279,6 @@ static void ibmvnic_set_affinity(struct ibmvnic_adapter= *adapter) stride =3D max_t(int, num_cpu / total_queues, 1); /* number of leftover cpu's */ stragglers =3D num_cpu >=3D total_queues ? num_cpu % total_queues : 0; - /* next available cpu to assign irq to */ - cpu =3D cpumask_next(-1, cpu_online_mask); =20 for (i =3D 0; i < total_queues; i++) { is_rx_queue =3D false; --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (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 8AE931991DA for ; Sat, 28 Dec 2024 18:50:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411803; cv=none; b=TKVyKst1ZzKBTUYk+AoCguA1mKTN8fvIbcQLbJOA9oVLdSd39Re/k2MVXLwrZ9eDKbn7JUgyxxcbSA+61GOeh6FpfvpGoRSmCKVqTHlt5t+rqWN2rjhyzNTZvLXGyKCtXi1/7f2tBTSs0gF61jJyJo/eHfhaAo6I4mbnHmW1JLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411803; c=relaxed/simple; bh=yVxpVKZjoO2fipBcpeXY2fMkavpmXRBYK7mOzB0MoQg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QZ0oYHWuIjoQcMP962A+V707HGi13BSwdsldzmNAIK6SmqRlOQWSuH1HQgqyS9jhPnzrRTn2E5m/Ssfx2pARBgGXezLt1xcPFZId4ZH+bifm+i43/jBqNlXguldjWoavAqVa5eEFvD/hWjs4vNomGNJ00QJJ1bI7xyCmpOxU7gc= 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=eEcu8eXr; arc=none smtp.client-ip=209.85.219.171 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="eEcu8eXr" Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e455bf1f4d3so7767351276.2 for ; Sat, 28 Dec 2024 10:50:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411800; x=1736016600; 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=a3EcwrJaj13JFWV94S06ao9wKNfTeeg6w6xP84y4x0M=; b=eEcu8eXrHNHxd5p0JLdTi9Au9CBclL8L0mLidXnXgD0Byyd67uPn88jknFA41Uz9j2 rd963fxqLfNERCWJKsC5RlbBCdfEjSJT2ye6uiBgNwKffym56zl/23vKWaGJTWuCGTuB 8Gz/fHQ5fn0qmse49KqHpxj4D4UuQ6dffqC0E1l1gmCfiKfMAxai7fDiPIoXlHkeBahW Cp3UNd4m36OS3bqJ4fxQa32WETczaFTTfKyXDWM+/Dk8CLgnHFiTEpuGW5ItZGqnCEVa Z++JkEJysPSQYO82VffIK4WHZvEavVKcupL5aEXoAbb/cQ086g7YYoZijImFkwTlHTjB i9dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411800; x=1736016600; 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=a3EcwrJaj13JFWV94S06ao9wKNfTeeg6w6xP84y4x0M=; b=IqxPfymaTeEV2G9jDbu+sKNvc8tIWxjDjMsclfsJ4ZGW8vHzosmSo7yrPXJbL0I5CC 7L6y+YccYe4pECVmcrQuBfNjUo9pgTJO94BdZ733LPVtWD+h38ZARV4uzXvVYlNw7yvB AbIyMGPqolntzjD7nD3sKI2q6z5ATzy/2fHJWuvGKBtAi9hoY2fhPncS/u88/NZetr2Z rFB2imnG4ScQ/DAAZtVDQ5dBGFVmH3NkNCUivRzN/OH3urMeb6qbOsN1Z7uTgnF7ZYtV ABe05tZN17P+4XJZo+FiYQT+WO5gjd9I80Fo5DN2D8XBRkfMvbWEZMKnYhjON3oQVvfQ Eg3A== X-Gm-Message-State: AOJu0YxCos2dJe3N0PADQ1PuNmooR7YB1ic4NN+mWVsKg8n8mWxGuT26 NmyAflz7Ed9YZXYDYyr4EprkpoEA7mvdYynkXytafmUXztPSBH6G2C4gTpYU X-Gm-Gg: ASbGncuEY14WqyHt3ZU6xiWydWwQLX+ITDQOKIT3/ZeiTADuLmMeKORDm99EQgXc0Nw onkNr69J8u0FeR4GQJfim5+9GCBEFr370UirNSj1QBy096IdVdWAA34+ijuBmvqxAkYu70NK5Wh Zsd6mPFEV3HcHp03utWehzwoJj9//Cytxbi2raWVsrg7IwK+S7isnxdMNmLgWONvn7/U94hLtaU DLNLiCFm1bNGW2QNHaPxCZUNQIWG2mSDRzTh1X7DfCn74DYXiCbHTrrPw0I/lmGYeXRn5lge/kS dZNpeVtBBQJReKOZ X-Google-Smtp-Source: AGHT+IHYxhV9z9c0TqaYoIc8tNJTOYJG9vJKS/fH54wKJcOX0hcp4pjTSDHzZiDSWaq/zIaFUgVQ0g== X-Received: by 2002:a05:690c:f0f:b0:6ef:698a:1f02 with SMTP id 00721157ae682-6f3f8219d18mr230627707b3.32.1735411800391; Sat, 28 Dec 2024 10:50:00 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f3e745648asm47410067b3.52.2024.12.28.10.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:00 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 04/14] powerpc/xmon: simplify xmon_batch_next_cpu() Date: Sat, 28 Dec 2024 10:49:36 -0800 Message-ID: <20241228184949.31582-5-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" The function opencodes for_each_cpu_wrap() macro. As a loop termination condition it uses cpumask_empty(), which is O(N), and it makes the whole algorithm O(N^2). Switching to for_each_cpu_wrap() simplifies the logic, and makes the algorithm linear. Signed-off-by: Yury Norov --- arch/powerpc/xmon/xmon.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index f4e841a36458..d7809f15dc68 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -1271,11 +1271,7 @@ static int xmon_batch_next_cpu(void) { unsigned long cpu; =20 - while (!cpumask_empty(&xmon_batch_cpus)) { - cpu =3D cpumask_next_wrap(smp_processor_id(), &xmon_batch_cpus, - xmon_batch_start_cpu, true); - if (cpu >=3D nr_cpu_ids) - break; + for_each_cpu_wrap(cpu, &xmon_batch_cpus, xmon_batch_start_cpu) { if (xmon_batch_start_cpu =3D=3D -1) xmon_batch_start_cpu =3D cpu; if (xmon_switch_cpu(cpu)) --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 1327119ABD4; Sat, 28 Dec 2024 18:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411805; cv=none; b=XiJUe1M9JimeHWQNYkHukjGRyrLg5Fa6k5Qp+yr8knAOefD4jRHbzweh3ClMqM1B84XNUT2p01jP+ZfwTjTIvJfbJEUTmhCs9JO2JR58x4bnE2SlaNR074iddxArohYJmaj1C2G147moJOVvUX7uNoLNNDeMAPUPBFt3XZLZzpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411805; c=relaxed/simple; bh=00KAaZiElDeuSwSawiskbWLQDjpCB7R5sWeWi2JBcew=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xox75NfqjfdF5LDcjjgGe0gudl4DNihB51X26kIzUeBxtjoOZJfLIGc9cYE10A710jzFLLCSuHCkn9OEmG2ErxiVlj5ey8guNxJES6asYJc9Z1tcCFUSbjYfHrTcgk9ejFFcbofG4HaXdgJNaVGw+1Z4b1SsBhwK0aWeC74MSVQ= 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=aL2ObHx2; arc=none smtp.client-ip=209.85.219.175 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="aL2ObHx2" Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e3a26de697fso8956710276.3; Sat, 28 Dec 2024 10:50:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411803; x=1736016603; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0bA6qa5mRtLx/JNJepZMf5RGZWm5ti1ameVb2qE56fE=; b=aL2ObHx2oNVLQwq4vzzcqeb7CgxJfKtxhe21VuYUNlYNmZ4B9TWc/12mv62z7tAk0D ZQZad+m2WeRSRDScpOuevkmmf2YaKue0pUCsbHJk2Eh9ErUFaXO+FfORBtUswlgdGj2a nli1y9vdXMmMviur0x+VVe/H1a3YvGdYxE1NOsxW1xerko2XRd+4B5GWFqpr5xrehB/m J8I0dSsFWJ9/cVJVndDYCV+CovuspuTOvoJkPeoXLtSswx2PL+r2g2aG4id/TQitn546 qBGceh6QFw7JgThQFNab5PoZA5ew4Jx9g1qUUyPtVCpnQM5EBJHia+hlyEf+kwHun2Ww y5pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411803; x=1736016603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0bA6qa5mRtLx/JNJepZMf5RGZWm5ti1ameVb2qE56fE=; b=XaiCPctElVabZ+Wn2vyADiE65poDmKZreQqIqA0ySVhR7yZ2qPDXOIGYqotZogbjmE Zvk0Fl2Kug7893wcKfKGuWioso/wWwUta4rWxKPb5e8zkRbLDWrLJH7s73wDkB74f+7y ILtyUrdSg9PCnvz3KydV5mOHPWFdhYJvQ1dI3B88lU5aSsLqvg/ACAA4+jxHvwK/q1b0 UelHFXR5dje5u6x3xRywAhyqI/lzTq3JmFGA9cGM8XOnok+6O0lPzzCtTGWyuLVJQeCY xIz45Ay8zQ/SGlK1HOeH6R4ixVzhDNTdIsCNKOMUMzdL5fHQ3FnUYOeFhjW6L0DAQwEs Zl2w== X-Forwarded-Encrypted: i=1; AJvYcCUM0zyJvtu93rrgSqQhqnlJaLZq2xO92j5kTnak0AFLJ984BLEQyn4vDVPE+1MTUc+dfvowiS3hxsdRDjgT@vger.kernel.org, AJvYcCUcnmxVTxmN4sE5CLh4LRP2kv1NjcVrFVyuYV8O8SD8Rzaq3j6gpaetTgaVGLX6m/0cnBD/L8tb@vger.kernel.org, AJvYcCVUrxtRb5zOWsI31oiH9KkZTx0XD6j9oUan+QTIxAAD7aH5jiJED4jf3YQTsI3Ug/3ZDoB8luKIhQ/X@vger.kernel.org, AJvYcCXSCJw7yqWHzZdPanqULSvwRJbkOMo9gs5W8UKF1XK0gPCi/kjwqozhbLH91vB1sJxYvzMQTAPHtTI9Hxk=@vger.kernel.org, AJvYcCXds06KnQhPZ+I2iQ5eNPa1EvsmgbT94b0+KRDXGcl6N5rWMP5MMCqGBrdefmbihJGXbrukC3iAEOgTJg==@vger.kernel.org, AJvYcCXfUQRXOWZPY3E3AuPSlwzpPEYdMyGDpxFitUMsmgPl6qZabYY5LJWN1DcnfdAyJX58/FFNNteRd2piUg==@vger.kernel.org X-Gm-Message-State: AOJu0YxP+uBW8v/PwWsCp2vIjcFs/z90sI/ZtIt+WUCoO1qnVZARS3R1 WTiZth0pLm6XyFQ43BlhhFOx4TARwlZFZqcX4UJPhvCW78o6nh3medUSgGGiqXs= X-Gm-Gg: ASbGncvWXJTis6OcAH9/JjphydM4SKiOkJooHMxgZ0bDndL8vtQRf1ssX0mFU3FyNAN +D+fbbAcP+nm6IVNVwbFgjh9sYO2ZxpfnaCr3Jr6xJSbODxdUxoEnT46W2hY15hkbHZUQegY4Yk 7dk0DusZb43wGW4lOIIUJ+UNkBJMaHt0FcW7RIh+VtuvGogcFqetuFXLsjjAljvOkanedG251UN PDCdE/C6Qg8Z4DbGmhoeb6YHsHDMGf3f6I4ibMB4WAB+8GuVzyh7UbjLP8g5ZRcepmRx3mV0UG6 X3pG7RkICNmYoNIJ X-Google-Smtp-Source: AGHT+IEdltlfo7VoM/K9Hx3CK/leMoimfCHWr7pfYR9wsJX7DjblcCmfKrexz0jlZQgTcU9bnrqr/g== X-Received: by 2002:a05:6902:1a48:b0:e49:5f2d:e71d with SMTP id 3f1490d57ef6-e538c267d16mr23706682276.21.1735411803005; Sat, 28 Dec 2024 10:50:03 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cbeba44sm5051923276.7.2024.12.28.10.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:02 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, virtualization@lists.linux.dev, linux-nvme@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org, linux-crypto@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Haren Myneni , Rick Lindsley , Nick Child , Thomas Falcon , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , Yury Norov , Rasmus Villemoes , Matt Wu , Steffen Klassert , Daniel Jordan , Andrew Morton , Greg Kurz , Peter Xu , Shrikanth Hegde , Hendrik Brueckner Subject: [PATCH 05/14] cpumask: deprecate cpumask_next_wrap() Date: Sat, 28 Dec 2024 10:49:37 -0800 Message-ID: <20241228184949.31582-6-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" The next patche aligns implementation of cpumask_next_wrap() with the generic version in find.h which changes function signature. To make the transition smooth, this patch deprecates current implementation by adding an _old suffix. The following patches switch current users to the new implementation one by one. No functional changes were intended. Signed-off-by: Yury Norov --- arch/s390/kernel/processor.c | 2 +- drivers/nvme/host/tcp.c | 2 +- drivers/pci/controller/pci-hyperv.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 2 +- include/linux/cpumask.h | 4 ++-- kernel/padata.c | 2 +- lib/cpumask.c | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 5ce9a795a0fe..42ca61909030 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c @@ -72,7 +72,7 @@ void notrace stop_machine_yield(const struct cpumask *cpu= mask) this_cpu =3D smp_processor_id(); if (__this_cpu_inc_return(cpu_relax_retry) >=3D spin_retry) { __this_cpu_write(cpu_relax_retry, 0); - cpu =3D cpumask_next_wrap(this_cpu, cpumask, this_cpu, false); + cpu =3D cpumask_next_wrap_old(this_cpu, cpumask, this_cpu, false); if (cpu >=3D nr_cpu_ids) return; if (arch_vcpu_is_preempted(cpu)) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 28c76a3e1bd2..054904376c3c 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1578,7 +1578,7 @@ static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp= _queue *queue) if (wq_unbound) queue->io_cpu =3D WORK_CPU_UNBOUND; else - queue->io_cpu =3D cpumask_next_wrap(n - 1, cpu_online_mask, -1, false); + queue->io_cpu =3D cpumask_next_wrap_old(n - 1, cpu_online_mask, -1, fals= e); } =20 static void nvme_tcp_tls_done(void *data, int status, key_serial_t pskid) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/p= ci-hyperv.c index cdd5be16021d..86d1c2be8eb5 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1757,7 +1757,7 @@ static int hv_compose_multi_msi_req_get_cpu(void) =20 spin_lock_irqsave(&multi_msi_cpu_lock, flags); =20 - cpu_next =3D cpumask_next_wrap(cpu_next, cpu_online_mask, nr_cpu_ids, + cpu_next =3D cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids, false); cpu =3D cpu_next; =20 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 7f57397d91a9..31622fb0614a 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -12876,7 +12876,7 @@ lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned = int cpu, bool offline) =20 if (offline) { /* Find next online CPU on original mask */ - cpu_next =3D cpumask_next_wrap(cpu, orig_mask, cpu, true); + cpu_next =3D cpumask_next_wrap_old(cpu, orig_mask, cpu, true); cpu_select =3D lpfc_next_online_cpu(orig_mask, cpu_next); =20 /* Found a valid CPU */ diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 30042351f15f..b267a4f6a917 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -296,7 +296,7 @@ unsigned int cpumask_next_and(int n, const struct cpuma= sk *src1p, =20 #if NR_CPUS =3D=3D 1 static __always_inline -unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int star= t, bool wrap) +unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int = start, bool wrap) { cpumask_check(start); if (n !=3D -1) @@ -312,7 +312,7 @@ unsigned int cpumask_next_wrap(int n, const struct cpum= ask *mask, int start, boo return cpumask_first(mask); } #else -unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, i= nt start, bool wrap); +unsigned int __pure cpumask_next_wrap_old(int n, const struct cpumask *mas= k, int start, bool wrap); #endif =20 /** diff --git a/kernel/padata.c b/kernel/padata.c index d51bbc76b227..454ff2fca40b 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -274,7 +274,7 @@ static struct padata_priv *padata_find_next(struct para= llel_data *pd, if (remove_object) { list_del_init(&padata->list); ++pd->processed; - pd->cpu =3D cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1, false); + pd->cpu =3D cpumask_next_wrap_old(cpu, pd->cpumask.pcpu, -1, false); } =20 spin_unlock(&reorder->lock); diff --git a/lib/cpumask.c b/lib/cpumask.c index e77ee9d46f71..c9a9b451772a 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -8,7 +8,7 @@ #include =20 /** - * cpumask_next_wrap - helper to implement for_each_cpu_wrap + * cpumask_next_wrap_old - helper to implement for_each_cpu_wrap * @n: the cpu prior to the place to search * @mask: the cpumask pointer * @start: the start point of the iteration @@ -19,7 +19,7 @@ * Note: the @wrap argument is required for the start condition when * we cannot assume @start is set in @mask. */ -unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int star= t, bool wrap) +unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int = start, bool wrap) { unsigned int next; =20 @@ -37,7 +37,7 @@ unsigned int cpumask_next_wrap(int n, const struct cpumas= k *mask, int start, boo =20 return next; } -EXPORT_SYMBOL(cpumask_next_wrap); +EXPORT_SYMBOL(cpumask_next_wrap_old); =20 /* These are not inline because of header tangles. */ #ifdef CONFIG_CPUMASK_OFFSTACK --=20 2.43.0 From nobody Sun May 10 07:13:39 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 7A34219B586; Sat, 28 Dec 2024 18:50:05 +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=1735411807; cv=none; b=Ux+v9V9afyQJAo6csLuFgOiBoaqZB/1fa3gfVH9pBejMR1CnwpoA+gCoACmgRc3OGRBwdD/30eZ2lIP+/PgRF4fyiQukMrQ7N1tRj7mHhtfWrlsnGp2FuR31VwnxftrcZbtChPaXAsJZ83maB8CQWNVyQOqv4nGLHftM5a7fKjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411807; c=relaxed/simple; bh=hMJtabK1vX54uoCs62Uh1uKXB0G3C1rvDyjRxtrbzJ8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o0bk2hnL81C547Hi+cDTdvsSfrLCv55oABgH+or/G6b2lbJ18ohMPCn+QzBz8b2ZG3B6LxzVTyqL7x3HcjmjTWASuaD057Z/+IG5zz2qI1hbMob1H48gUyAzSKnerqeXzID11EGqUwCR6ojprvB66aQObLzCn6f8SfxYGY405hE= 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=PuKZJaMN; 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="PuKZJaMN" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e5372a2fbddso10325159276.3; Sat, 28 Dec 2024 10:50:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411804; x=1736016604; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=S9g5yzfm32qCCSZ9hYX8RFrDFECwqUd1W8h8dBnaZOA=; b=PuKZJaMN7FM+htxTzxyU2Jh6Tj90YZj5dk4dLhZ8e64xzWhyoWeZ0dPF92AXKybcEL HC381gJKDAgRrKmOveaDxQZ29tFgQyh5DOSC/8uqHwMOtsYlKryM+dgCO0Gqcah5uK53 NN66t1T3M/Muf/jCvJhWT6dLfXOZZIeKDK1KGmDTn5RlqTJqUE2GJcXdx2kd1YBS/NZ5 y11MRSF6WmK2ZcMbVzuFlm1uaoLGAX9pgx5v/fq8c2hzhoR+R3oi+T49iN2C/DITMI8X Um830iWdX34tWyYafNK3Z91zsvAYhrl1bbkPz3Hb+N9nE6Oq+LwlfqDPKL4De0lz+jo6 5KKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411804; x=1736016604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S9g5yzfm32qCCSZ9hYX8RFrDFECwqUd1W8h8dBnaZOA=; b=HMehnsPFmKvwTQAE1Z3mFY7mZPNDj9cAiZ39yPtxAFAM9U3+nFKjBFZeCaF/butfqK YWPpocL+MsDqitGN51tgCd0gHt8mhxLOkbDX9ADA/ew3YjplG0MmIITs5qX0CJ4MpS32 eqr6ulDS8njzNQyWs8VWBSuNN2Be/mYID7ds1J96OPzy/Wv7T39Gj9CzTELZ0UIdxrvC /lo4yZ14S8f4XwjcVR50Z9CzwE8/w69NlDyFl8TGtNskV/ROL0IDkL2jhQJwg7waMekv qDUy26HW1DwxdH6rkwZf1yUW+/Uj90OhGRikvDhyC9c3BDKL998Gzmsj0iKawDfAukkz AhrQ== X-Forwarded-Encrypted: i=1; AJvYcCU8MPh1JlRZLLJ6dV1lR6k4MhAiJnlOF/+ATdAA6x49jhVxCD4i2EnSVWGDDx/KrxELjF0JUXyV@vger.kernel.org, AJvYcCUr/AmaZy9FYF37P6XRqyjnubZGkNKhneDkBJQn1ERItxLQ09GK5CtbiO7hlRMsICu6msn46kVZeHgixFFu@vger.kernel.org, AJvYcCW/t4QjK1oJQ24FH6Yzj8ASUze5SjBxvUx5fjpkEPzxxltHxXEb/E14jfGxqt5ym1ocs/dpu/8MXiDL@vger.kernel.org, AJvYcCWnDRDNqVf7t6DU5BJ5Qc5u4lWJ3r5zLap4JTgfV88nFOZ3dY2LwxlwZTEIcRZLxefCAMxIsYxHF+zxbfI=@vger.kernel.org, AJvYcCXBXQpyg6zd4wVz4B6or52CX6i9ntNREp5H4G17UbEGCuv9VdWJWhTONsXcptojD8lR36a5rdRCNcnIyg==@vger.kernel.org, AJvYcCXmYs3iaVPeu+vN8t9StpFo1GRFo95FSCxh/G0EcQaGF/7XCXq9fP6ZuIXD8JBMELfJHl90hI3AaIPL7Q==@vger.kernel.org X-Gm-Message-State: AOJu0Yy1P2eBpvhVWT4uyg/VljvtOyXT8CfemHR9tmmgEO1Xh6Basg3W +XZUNl/1TQRvlbVXG1DJPq8++DNT5GiDaX5hrQ7k+vnU9IBYXnOgcT0Xthd59iw= X-Gm-Gg: ASbGncuYAZ8d7s7yFOKP6wXHVt/qBoqNXzL0+HC0fKdur9EePJZBuOxgmy5FKIukU1q vBDw1ZloYbyeNp3v/enrslFrg5vyB2ACWY+/AxAwOypWGcXrkWW9HInEJAPwGZRpoZGcbpFvSc3 rWxeh0C4yvXySXzTbrwgfLVHHY5hQXJt3R1IFu0EMHObjkLoiGLQYy4UlNVar5CnB79cZSekACW H2gWWxcJs2QAkCCDWB1yuOhlI+x16/ayptpnDeT5E5Z355KFaqwYYhL8gMCyI5TZkLfhnReSyIw BDdI6RkN1HkKVIWd X-Google-Smtp-Source: AGHT+IFRAv4ES1nGe5GZzQSCr0JvuQEh3E1vBTb1UadMisfKYeWtlE6qWVQlRiPBMv3C59QKs6b8rQ== X-Received: by 2002:a25:cc1:0:b0:e53:4d98:7459 with SMTP id 3f1490d57ef6-e538c3cfd9dmr14310782276.40.1735411804331; Sat, 28 Dec 2024 10:50:04 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cf73675sm5102193276.51.2024.12.28.10.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:03 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, virtualization@lists.linux.dev, linux-nvme@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org, linux-crypto@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Haren Myneni , Rick Lindsley , Nick Child , Thomas Falcon , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , Yury Norov , Rasmus Villemoes , Matt Wu , Steffen Klassert , Daniel Jordan , Andrew Morton , Greg Kurz , Peter Xu , Shrikanth Hegde , Hendrik Brueckner Subject: [PATCH 06/14] cpumask: re-introduce cpumask_next{,_and}_wrap() Date: Sat, 28 Dec 2024 10:49:38 -0800 Message-ID: <20241228184949.31582-7-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" cpumask_next_wrap_old() has two additional parameters, comparing to it's analogue in linux/find.h find_next_bit_wrap(). The reason for that is historical. Before 4fe49b3b97c262 ("lib/bitmap: introduce for_each_set_bit_wrap() macro"), cpumask_next_wrap() was used to implement for_each_cpu_wrap() iterator. Now that the iterator is an alias to generic for_each_set_bit_wrap(), the additional parameters aren't used and may confuse readers. All existing users call cpumask_next_wrap() in a way that makes it possible to turn it to straight and simple alias to find_next_bit_wrap(). In a couple places kernel users opencode missing cpumask_next_and_wrap(). Add it as well. Signed-off-by: Yury Norov --- include/linux/cpumask.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index b267a4f6a917..18c9908d50c4 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -284,6 +284,43 @@ unsigned int cpumask_next_and(int n, const struct cpum= ask *src1p, small_cpumask_bits, n + 1); } =20 +/** + * cpumask_next_and_wrap - get the next cpu in *src1p & *src2p, starting f= rom + * @n and wrapping around, if needed + * @n: the cpu prior to the place to search (i.e. return will be > @n) + * @src1p: the first cpumask pointer + * @src2p: the second cpumask pointer + * + * Return: >=3D nr_cpu_ids if no further cpus set in both. + */ +static __always_inline +unsigned int cpumask_next_and_wrap(int n, const struct cpumask *src1p, + const struct cpumask *src2p) +{ + /* -1 is a legal arg here. */ + if (n !=3D -1) + cpumask_check(n); + return find_next_and_bit_wrap(cpumask_bits(src1p), cpumask_bits(src2p), + small_cpumask_bits, n + 1); +} + +/* + * cpumask_next_wrap - get the next cpu in *src, starting from + * @n and wrapping around, if needed + * @n: the cpu prior to the place to search + * @src: cpumask pointer + * + * Return: >=3D nr_cpu_ids if no further cpus set in both. + */ +static __always_inline +unsigned int cpumask_next_wrap(int n, const struct cpumask *src) +{ + /* -1 is a legal arg here. */ + if (n !=3D -1) + cpumask_check(n); + return find_next_bit_wrap(cpumask_bits(src), small_cpumask_bits, n + 1); +} + /** * for_each_cpu - iterate over every cpu in a mask * @cpu: the (optionally unsigned) integer iterator --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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 7A20019D092 for ; Sat, 28 Dec 2024 18:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411810; cv=none; b=CnbbVksRsQLtN8RFVjL5nSRalTBG3RJN/UMfo4uV7SVu9bTIpVQMwHobaskiJCmJupZ08k9pxaIIan97sqfBA2Pdk3N4tB/knR0+UuWwNbpJxH6nYJiwX6fyJjUaBdjrYm/pqVNKUJSlIlIyZUZd9C5lf/7Ow6W4HJc/h7rzZ8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411810; c=relaxed/simple; bh=zQcJmL4DY4K/3SK0135fbUwNJnKXd+b58KzOGQAKa8A=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g2GWDYQSFtcV74o3iOr3fGokiv6Ob5KU67c+KfQXfWISjKBgzxk5tQedUJZ7vm9kaOL65mT850K9zcXC4v9VdzJz2BpMCV2Zuqjo+guTgIs2DmROHsqHSQpwZZsipOtyGI92ihRrVE5jGr9O0VmlSpz9XfCwzwNFZRTBWQ7ZWgg= 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=Q8fxHvcM; arc=none smtp.client-ip=209.85.219.178 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="Q8fxHvcM" Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-e53aa843a24so7581476276.0 for ; Sat, 28 Dec 2024 10:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411807; x=1736016607; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=l7976T2mPCTdZIY1BKxms9DlxI8DO4T1ITHA6MvqiMY=; b=Q8fxHvcMwlylhSVKHZBAG9shhRQdaCZCjT5J20hAg3yOh9R0ZDAq+Fziq0HCD5HHU/ 0IFRy4KOtC7Fty+GS9AJsP6+9VfN7liCgweGpix2gdncX2WYyU+tXurfvDo3RBbyHTRH qQ49Ixejb/ISfc/+NabIZjBBr3EFVzzM0G7u89XF8d4MBCJyEfWWAbahvzaH0pXfXHIe McckyGpfLd7eeTX+gGWpbnm/J1hFI5kcmQ2/TJS7KbWQMPq/20VyqZnR7+8bGYStM/Tw UhJDPBSV47xenbFg/HDH/wzjjCG0tA6hswL6bOp8jeNzU3/XpF1zdV2LDov+e38ZlbOF oStA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411807; x=1736016607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l7976T2mPCTdZIY1BKxms9DlxI8DO4T1ITHA6MvqiMY=; b=kYDLunH7ZjSwmIBxdSROJsFEHfM3XyrWYS/lVgKw/dLW2vdli5cNRc5OW3VRCgUoVE Fon1q1kq/k22K4NoyXAyAlNuMUh6fOfgUdE+KveoVB9mWOEXpAiSUAiflKCMfogmFU9Z 35M2oTKbp6NeqE7U4RhUn+niDxcAGywqSCc1/d7l0tg1XoU3Fw5ZqtaVu97LDOgC4sjz 2hs9ddB4fQc08SRUYzOkZn0cA/3EfbH2BQ9YJrn9PKK9kKnM3J35WzyuYimKSxhzL6qH 3JwKd4P7GP5zIYSjuSPvq6xoFEv2/8eUqSFFKojERUlRGLLzxf9JGMWbv1cT0OpDWqlc d62w== X-Gm-Message-State: AOJu0Ywf6POh+f/t8qi+ihSErqqP1IvSranAoXYeDQWOD0D99clCRhFE mx9pI4eD6483OZQ9ki15urLdogOZbdK8TtV7pKPunJ3FFgGfZ3m0jXay3pVV X-Gm-Gg: ASbGncsDFV8GwuLmeTdepQ1zJsP8n0HrmVBiXjcX7cl0UZ/uECv4ZiNwyRkWLY1BkM4 /4RlZKiaeX8wI1mix2//T9WA52YWtUDUqw0OTRPQXqb7K6RyIn/Tqems1xfvI9GnaWxouZtrR5Y in7S0LZVvUzCygh4w4GNFqKfP7IHtN0rtRpKDGaiHLHy1wZwpSxcMnql4wYtlRJfm7R1IBUqOoi JomtCafZv+HLuEQfuU+7xBzCAP8w1uspf7WPXtow3a8LAcGkLlSr2ciYkPJ/5CGE75aYXin2ky8 G/KeRLAQer+Db6Ll X-Google-Smtp-Source: AGHT+IED8wrV/IVO/cyAxg2Hu7SN1HzXvx43GGdBW/kSHbyqN+fpiqwcPx1qCtpjh8hPFArCZfgAAw== X-Received: by 2002:a25:6a56:0:b0:e38:b460:e0e6 with SMTP id 3f1490d57ef6-e538c9e8d52mr17161694276.0.1735411807369; Sat, 28 Dec 2024 10:50:07 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cf7393csm5102042276.52.2024.12.28.10.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:06 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, Yury Norov , Rasmus Villemoes , Andrew Morton Subject: [PATCH 07/14] cpumask: use cpumask_next_wrap() where appropriate Date: Sat, 28 Dec 2024 10:49:39 -0800 Message-ID: <20241228184949.31582-8-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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=20 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 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 5CA55198851; Sat, 28 Dec 2024 18:50:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411811; cv=none; b=G8HU6MsXCi4YNVdFTVbQm/q4NLQMpThYdmgYCzIZbqq3XyjCxYe+yBHzWN6c/DfWuWgDcXEe59iza6OhjW0C1CarZ46yAl1wYxb0NJrYxcksmS57v7jdO3+qGa0BnsgpAbLy2lr9MKEoyuqi5aT5F6iKK0SY4v1UirsxVrrVvNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411811; c=relaxed/simple; bh=Y36qpgZuNibHp/0b/M35lfq/59snkWlET4iGJIGq+a4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VO2ykMNf+HweV7g+9uaYpIirfoSU8OgwjBC2Zescqq3MkWpNAsgxmyf88dr/OkjgBNqj7M7oyJg8/vLnJ9DC3ciPdKuIpfPwiWAzSuHnbqRhX2ccwaF+f1EFGZ/HjvH8PYyRLfoGp6rx+E3Ca0n6mHcRiTKGX/DkG2SLbyJ/cpU= 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=ZU8asaI8; arc=none smtp.client-ip=209.85.219.174 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="ZU8asaI8" Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e3c8ae3a3b2so8333341276.0; Sat, 28 Dec 2024 10:50:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411809; x=1736016609; 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=jD48FtZs8AJg9NzYr99SZEdQPts4PFMxSkqb2AKddOM=; b=ZU8asaI8vFw2opbeAIHQh23y4cyZhfP3/WgHAq1A//ojgKuywLqTypnVt0YQToYovH jQMqTtp8GjkKCOiSyNJEU9Rq/SYL8Alml17awMs7LSWNa+BJoS4MDA7GQXMcA9b0alF7 ALKsVB0Ta3c6pzLrYqeIDDXvqvc6983jSsdrTMANynjYFctPtWrIb4uBcQ9dg17L/bG2 pZ6vwBYXUOAuvmm0TY0rzT8V4exaupPE/3wAnfhEWagPN8g75LAQh5Abn8soCPYPddID DJXqi6IxpkyQ+0+qsD0eFO+LRlcmmZUaVAKZXoT26vAL3H6XjNcjcVG21JOv/weeM5/i tOcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411809; x=1736016609; 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=jD48FtZs8AJg9NzYr99SZEdQPts4PFMxSkqb2AKddOM=; b=tNJ6Zy/9Ig7BV1vy723aPKqPHlrctJNcPwnSbfVcddDOZmKzh/v2pXuUThksI8Ppyf bQoMuSMvfkDHjptbYhQ/vJgR+pluoF5njai+8es/tJJL0VVSukItUZXjwwOUBel2oPBo 5cUrnpD3X5Q76o/O3nmDRxIt7QJcBPyRexkPmpjMHahjRCgtinAqSCV9iUCxIeo2Bxwd CCOCLGfcjYsLog/WUKnRUCyDwv/n1N1PVN2WNM1txKQ6MIbbIJm2GSE5vzV4x1FSGoVX bWtj37DHAwPF4vwnYIO/JsmRS7Jxth+idfnCfNeusyFZYtVv5A7dHAdIbQ8C6UnrYaZv Bbhg== X-Forwarded-Encrypted: i=1; AJvYcCUzENHO8BF4vnu2bHzI5SCo6vvJ5fkJ5IdlP90u9wUN4rP2QbvgX0Wp+IAJPOv7uxfQjll5Iw0yHvnWHkM=@vger.kernel.org X-Gm-Message-State: AOJu0YyvGnHnIJ9oqwSlXhyFG5jBLzdF7I5o6DOfN472Q5Qgy/9tKLSF EtYTzfEkHUe9tHPO+Oybd9lW4yF7FYg8Nxlor2zALftGgthJktRkYVJC80cV X-Gm-Gg: ASbGncutOtT3+cTV3TdzJWylofhH8bMKr0Mld0xhF4IVweshxDlpfhEabzn5t/Q00QP wp+fn1I/UrCJ5E++UP+uNkBrnxhYSLAhvLAHQGD0Frdg4Uwv3P7h7yrjKYkfVJ5dal2YSsnjKnq 7D+q8Up8xmBpDvRpbemH03JguB2GrxL5mwGl0pM4Vq2EePkWmnjOkuATyyjaUTAag53sfQLcgPc hYN7tu6krFadra5O5geClvyJ1OFnZe1APxNuwzaYJvqfbpZrryOkHDiElFqUOjky6msgRzbBQQY gTytL1NrMdTkmwFL X-Google-Smtp-Source: AGHT+IGA02mULLXTgZpc9KsUxFci/4mGhqaGX1XguU/K84YbqdJFXZAgmyx9QVhduS54arIbyISz2w== X-Received: by 2002:a05:6902:1448:b0:e4c:66ab:ed4a with SMTP id 3f1490d57ef6-e538e10a164mr18335009276.9.1735411809420; Sat, 28 Dec 2024 10:50:09 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cc1cee8sm5171710276.13.2024.12.28.10.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:09 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Steffen Klassert , Daniel Jordan Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 08/14] padata: switch padata_find_next() to using cpumask_next_wrap() Date: Sat, 28 Dec 2024 10:49:40 -0800 Message-ID: <20241228184949.31582-9-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" Calling cpumask_next_wrap_old() with starting CPU =3D=3D -1 effectively mea= ns the request to find next CPU, wrapping around if needed. cpumask_next_wrap() is the proper replacement for that. Signed-off-by: Yury Norov Acked-by: Daniel Jordan Acked-by: Herbert Xu --- kernel/padata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/padata.c b/kernel/padata.c index 454ff2fca40b..a886e5bf028c 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -274,7 +274,7 @@ static struct padata_priv *padata_find_next(struct para= llel_data *pd, if (remove_object) { list_del_init(&padata->list); ++pd->processed; - pd->cpu =3D cpumask_next_wrap_old(cpu, pd->cpumask.pcpu, -1, false); + pd->cpu =3D cpumask_next_wrap(cpu, pd->cpumask.pcpu); } =20 spin_unlock(&reorder->lock); --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (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 8CD00198A11; Sat, 28 Dec 2024 18:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411814; cv=none; b=bpj/Aoz6IMTvu4QdVj417hhjI5MjGVzz4lygx3HtLWcLT1fxhFP2OPyiYnX/lHDo3fgCLF7MTVuqMCKMErOZR2A4saSXA3+UtPKmYMwdEQ7xZeZ7fYnj1Zsp0e+hqfBzIEPMBznKVe9fMu1qALHGjuar38tVyKc8cVminY9el6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411814; c=relaxed/simple; bh=yMRokBhP5H9OnrWHlTrwNrH37XaeTKVZOm1a1AkboLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G3i2scVtSp2PGa1Gr0FMP3SsygBHyVDUPOVvASUbaEOhOWAv3ykFgrZ+DXMQ+1WxMeDcOQtKtOSr+qH/gp8ioq8TjfQW/cKoAAlrJSCgdbk8emAUaJvUBzs8Fiy7quq+9rQyu+39QoXuLiIwH0S2tIqLC/jB+2iSMbtZHIfeyxI= 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=KFq7LJLG; arc=none smtp.client-ip=209.85.219.172 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="KFq7LJLG" Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-e455bf1f4d3so7767494276.2; Sat, 28 Dec 2024 10:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411811; x=1736016611; 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=sUFKYgpgMmlqbxBNoSqa7nmpKlvvBTB3tfvr1dpYSeQ=; b=KFq7LJLGwlK8YiJoXgRBelOVZZTnyvY2nytry0uZxSAR+MUgsbe3KfgeINbcdcgiXe 5fkacVSUPxMaoDxGqqYwFAwgXUPSnD2NG0ZY+SZIMIGxiE4VqfSUBhUQf/k6TfZXJEZX 4nE4cblpbuO0F8I/tc1P0GWgOfyqk8vQqpNP13iC2vczJ8CZGBe9qXETwvDqBFgdy7Qg uWujZaLjhojfTvSc91RHwlFxesJIfCtZ4Z8xpxo8WnICe7P6dcBRH2L2lvIHiaKoNc0B LD3JN6AmMHuAzBhpNq6Jsy5pi1JOUBd3bhklqKaeyPDuA7QraIHRHaqQ4+9Igdg9dmQm mH2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411811; x=1736016611; 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=sUFKYgpgMmlqbxBNoSqa7nmpKlvvBTB3tfvr1dpYSeQ=; b=lrDLKbs4oqs1gZ0kvyPVwQlw8eY09T0CBlSj5DOObzNio/ScfOCIl+okvn1iS0NHmR Pg+OTdqRCaXXxSVsb9iQsaHS7M+fUzdz8wsPrHj5ywszFWCwIDRBWvqBCbDbl+NRvVdZ 5A64/xMr3y+JiDRWlqKiaVJSnowN0pmmNhNsMPhrfKImIkbEnmvzqgqyGGkufIBW+wxg xKVpSwdMSCUI9p+9phb/RbCLkyVqLpBPobzOdr10tfz/4dTQe4qtC5/uPA0MmooM1ZnM 9UxvALUBba4rpKIxJo7Z9Zq2Np2sQel9J7uGXfsesmZeB4r+Nm373iWK19zeaJpk3AdC /VHA== X-Forwarded-Encrypted: i=1; AJvYcCX0k0RNLSWbTVVCAzQdlSmyiJPpQE+AepFqO+qJYk01yy4RTp2BcMEnHRq+lwxYQNgKuP++n7hTgfT3@vger.kernel.org X-Gm-Message-State: AOJu0YwaIGHeVN+2nnP9WatP6FUI9jtbYi4t2pMDw0BtZpSNcOxQspob gY2PDYbAEqsUvHyTfe86N9TGdIhB/lSIRe+SL4cuv+rca/LsJVqQlFnh0+CG X-Gm-Gg: ASbGncv5o9BiBypxlfs8SFRWzI9WYFbCuz42GzuauuUirt1qI2fPqsG9VZDr92JBrRY 3cARkQGHuqR1bxCpkFd6a1FHVQIEhPH8K1PxeI48vnKkQzrqy/z/IRGJaXHX0VlLd071zEXaWaS iyzaJoAecD82e9W+/EA1Ss2d1egZxL6k5THHg7gAgqX5Nc/xfJc2hK3aPtOqQSQHFpfFP5uB091 L5HX23ImYRmr+wzAS/0wY+icVFv1KKXMFfuYfIJMZ18HUiTTXQNlZf+4iWojotLjwQwfiyzXnnh Eb+oUNkkEdd/iQwm X-Google-Smtp-Source: AGHT+IGTNaVqC/daoVMVBtzDeK7oD1Vqtlp2wRGbrLq1WFGPzMvhTK30Z5nK9/LGFmnrqe2God+k4Q== X-Received: by 2002:a05:690c:4986:b0:6ef:6107:69b9 with SMTP id 00721157ae682-6f3f80de66bmr240481937b3.7.1735411811562; Sat, 28 Dec 2024 10:50:11 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f484ea9ce7sm3024807b3.92.2024.12.28.10.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:10 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Hendrik Brueckner Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 09/14] s390: switch stop_machine_yield() to using cpumask_next_wrap() Date: Sat, 28 Dec 2024 10:49:41 -0800 Message-ID: <20241228184949.31582-10-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" Calling cpumask_next_wrap_old() with starting CPU equal to wrapping CPU effectively means the request to find next CPU, wrapping around if needed. cpumask_next_wrap() is the proper replacement for that. Signed-off-by: Yury Norov --- arch/s390/kernel/processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 42ca61909030..745649ad9779 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c @@ -72,7 +72,7 @@ void notrace stop_machine_yield(const struct cpumask *cpu= mask) this_cpu =3D smp_processor_id(); if (__this_cpu_inc_return(cpu_relax_retry) >=3D spin_retry) { __this_cpu_write(cpu_relax_retry, 0); - cpu =3D cpumask_next_wrap_old(this_cpu, cpumask, this_cpu, false); + cpu =3D cpumask_next_wrap(this_cpu, cpumask); if (cpu >=3D nr_cpu_ids) return; if (arch_vcpu_is_preempted(cpu)) --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 C73C519E96A for ; Sat, 28 Dec 2024 18:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411816; cv=none; b=OEigoN0a7DwyOMExFDzPDBhmrRIJY7iX6JptdtY9YDHuoVIW0aRlItgqtsVtHZJxE5/2w2ZE0FguVjy0Imp1TEtGD65SAu6xihB2yTSq1eK72N0l+Kl+ISzmkjGEtaN+cfxP7wczT2kpuqItsNHYS38ei0CEAQkNNtMjXNmdPp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411816; c=relaxed/simple; bh=uyLT+67e6Kxba5Dx2kHvNVOmE7JcVcSp6B/wxhMWlAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dFPX+e7LBfFhLYPRF+wRW9tUPjGPtHH3fTxndru3NSHS4iamcV/vdscG1YAT3EktPajo800N+2iBq/laicAfwc2/31hTN6x2BJK43oKM1DUS1MzpJbQeJZx3QOV47zwSLVCUJh3XP9urJGkD+nb/3DmjXVORMQVLgxDSo7Tpuvk= 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=FX5yxX6b; arc=none smtp.client-ip=209.85.219.174 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="FX5yxX6b" Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e455bf1f4d3so7767523276.2 for ; Sat, 28 Dec 2024 10:50:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411814; x=1736016614; 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=AENc4Z3ax7rwx0f6UlYvVrtWhnoX8l+2h80qRPNl/Jo=; b=FX5yxX6bLXUKRj9kXNrMT4PMRzlQ9J3AaAn/F9AOJiP9IpPm20RWZiMxRbeFThM4O8 coJo1SzABk8vKuujGq+9pBVs/GPhZsfWZQ42gclb9MxlCos67iFumZAvabhLHnPzlaQ3 GdwaE7GyjPXde05Fnr4l/MCxgQW2vSTLxJ3VZon0S24uZ5c18AI7OU/tQqAJO0vJRBvA cZ4ubznnhTwzS/aR+9JRBcireTtTm8QvZcXP0y5eoPPGbhP6a1EfFl3QYEv88z9RY8f7 CX/V4ZyyuDrm3VUYbA77hpBHwrqHb+UduIXXXpB4XKs9WB4+W/Yg1xVe92myS9291/7P jt2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411814; x=1736016614; 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=AENc4Z3ax7rwx0f6UlYvVrtWhnoX8l+2h80qRPNl/Jo=; b=LZDSAIKzX5gKAtl95rJ4ECWg+Cc0+yXerZM6/Ox2j27191PphWGZWMXMJkXlVJ9V+M o9WSA6hj9vObSIKzKRUrJT0eqrBErXJKMNnNUIHv+uU7EjAfwZLrorj49FLhGrhZxF3g lFpIcGcweymDmJWSP0uEujacgkBpOpH88RaEtbYQuTBWEFYV29NiyUBfT5vCzvP+vnHs UPMxVrpOABzIOzWBtoLIiQIZ0oYrtcIFaWIWHPeNSSW2E+rjzCg1y+JWjBtxL63vu1r3 HcLZyIVHDYsREabwPB5JdRT0x6iw8a/bmMMhwsn/gedMsxpjErdw5GmXe4VpZ5SgibtU vN6g== X-Forwarded-Encrypted: i=1; AJvYcCW1f96mwF9Zm3O2tXTMBlRFH+FOE/opCVH2GuwBX04VyzQA08/GZF4rZW4kUqWSoiHgqHCkpz74xH5qXi4=@vger.kernel.org X-Gm-Message-State: AOJu0YxiltdiVEWACrYtNcQxB9QhIifpfZ4mYW3TyY3k7xtN/euga2I5 Qv6fVQjvmTgPafmNyqqe1Dk0/m/T2Kh2ZR6XOsp4rNOR7z940A92 X-Gm-Gg: ASbGncvZf5f2FSMwixee4Qq5CjQme9c7OGziL52N6x06lFkphjxTAf5r+RfV+HrtxXt QYH/otsA9vtU9kHJk/sDAsK+0l6V44wk+vksEuovjO5T9H4mPqGo3Z/eeSwrTD4yr93lx33RNQN DwDMp5jslsvMR/Xdx9A8hD7RR3Ti2SQDWCLdq1tp0c6htgp77qopvsUzZtPW7fHLYDnGinnFOI/ 7zkivL2UUl3Zf+n5u1hyIWvQHobH4SeFUXxdVXGaAiqSXu/wdJyQXVK5YBAb7nFuZqzLT9j1YRe GDhj2QvsPd+V6Szt X-Google-Smtp-Source: AGHT+IG7gNQAzyDpww9VP81evosoCFfnUVTHMGuH++JEv5/DY1rdC5GzeEk1nuPACT/z7N1na4UEHw== X-Received: by 2002:a05:690c:6188:b0:6ef:820c:a752 with SMTP id 00721157ae682-6f3f814565fmr201190567b3.20.1735411813799; Sat, 28 Dec 2024 10:50:13 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f3e7499b47sm47971617b3.64.2024.12.28.10.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:13 -0800 (PST) From: Yury Norov To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 10/14] nvme-tcp: switch nvme_tcp_set_queue_io_cpu() to using cpumask_next_wrap() Date: Sat, 28 Dec 2024 10:49:42 -0800 Message-ID: <20241228184949.31582-11-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" Calling cpumask_next_wrap_old() with starting CPU =3D=3D -1 effectively is the same as request to find next CPU, wrapping around if needed. cpumask_next_wrap() is the proper replacement for that. Signed-off-by: Yury Norov Acked-by: Sagi Grimberg --- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 054904376c3c..088101c57f53 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1578,7 +1578,7 @@ static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp= _queue *queue) if (wq_unbound) queue->io_cpu =3D WORK_CPU_UNBOUND; else - queue->io_cpu =3D cpumask_next_wrap_old(n - 1, cpu_online_mask, -1, fals= e); + queue->io_cpu =3D cpumask_next_wrap(n - 1, cpu_online_mask); } =20 static void nvme_tcp_tls_done(void *data, int status, key_serial_t pskid) --=20 2.43.0 From nobody Sun May 10 07:13:39 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 ABA8919EED2; Sat, 28 Dec 2024 18:50:17 +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=1735411819; cv=none; b=QwmGcH1ollIwVmLxFAUN6ySVigFWSmL32fVyRcvti2yRP27em5SGcXfBDjP0O/ADugETDGuONewwbVwetbvZZmMvaLK2AYpg1uNakVB5ntab5QKlimL2Q1/8FRTr1CqXE9NEpUBF5UjGQ+gyiCRUVFpbKDeqvi5M5cS3lvLYo6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411819; c=relaxed/simple; bh=s1rUMlu7DzVnUwDvM6XNMOc3MzlAh/fRbyTbur6LiVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M8hvZWN61fA/ku5giLFjKeDVkq74bJ7gOFt07kuJ6/c8YVp5bxpUonri6m2yEZl1V4vQWEspQpfhtUIkR5sEyTEkunJ/OCs15qjHldKoNkjyJNEz6uPJYFHNWukA2k9dpffsZWTOr7Iemd+pF/Vj8MhFqhsJIwq1Zn8FrfJ1VNE= 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=cvVNDvWi; 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="cvVNDvWi" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e396c98af22so4237708276.1; Sat, 28 Dec 2024 10:50:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411817; x=1736016617; 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=uRlDoR4ytnS2bQfcaaePRsRcamLJG88lUbbmmAU/YJw=; b=cvVNDvWi0iHS8bcjeV6A4002fifCA7dc7ltEF0UGbkEletabWtG/sf3XfvUFAkFPUU iBCYjDOkpwMGfJ/WkBsVXgVXLuyW3SHSTh1lDRXFGwatUKvjay4/d37U0peAuSTqILUV 16aQIz03Xv2gOO+y18Sg4QUzSJUSLYkRwvdM7wQgHY8CkKbmCdJE0jdP5Y6GtyOvH4jA vQvS4FzT5lvhWOmPh7EUdb3uEMZVQdANrnu8bHOPPtDJz0iHCixZFKXPPCGeCSDtFg/E PBTy/fFRj7zddPyUmbKUZ61H+EMNOxbNu5qeM9+Pd6f2oga8ZQgJXZSo4B6a0ZrqClM1 pUqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411817; x=1736016617; 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=uRlDoR4ytnS2bQfcaaePRsRcamLJG88lUbbmmAU/YJw=; b=rz/uoIqHPuDAQcmagMFKJs0AxbT9q+r/pxZyaIqIEczAa/3RssFTP9/LxlmXVRsVLA sipIn0wevu2kfUpqDXpWCwj7OpMcwCkJ7YQ8uPULiyIrkLHK5NAlTBgVtPPBzYx0ZQ13 OffyLmSQs8zraCD5Hw+sicn+clY2KVX8xchzkMjeDNha1hRppNQvkMufXxXe+N7MpWty wsXUWp6zsHFKVFPMNZeSHZ0JqamF+SCt2p231/sxNgoyZT8ehB8OpfKJ4n/kLSK+9O1A EUECOKzYVBAcDua709EkzEZeoq4AYTEeCuw+8/5CYFSyB3VPHu1goievpONi/bgPuArw xTjw== X-Forwarded-Encrypted: i=1; AJvYcCW/kc+e4O3VBdG3B97v/gHjmgpgHa72Y3Y68JtaKZ6MmahoErUvWkncFolzGemTQRPnQz8STbCG2fX0@vger.kernel.org X-Gm-Message-State: AOJu0YzpqK46lo5v2vJZy55ko7WpGH4KqeJervVkZ95Mlb3wZ3IQ73gT KJCxAtNp6/b5sNhLXzO30pq3GfeCRmjlvazRBAYVNQjGcfDKDSYQdrzubZn4 X-Gm-Gg: ASbGnctxpthxJ+sqHwDhqI1fGbX+br6gLgcenMNPM9ckH4hD6yZLHBpptW0wjSZIS8X CkKpYEiM3WPS6dQ8qmIYF0u2CRigbKYrzMlUxBUvgbxi77azYiy7IHuY5wrUjHn0lTazJB60UFp 3G1VjnY12nP3Q6/fHZNVMH+GGqKRAmay2O7hSlbZw2U5LJovY5TSJF0Xq0kpHImcJS04ejPfmee qlC+QG4uZGIc9gxMnarVjqDVpC9KO+3PctBqIQ7yRg7+f3Qk8C2auRI9SPwyoGL9/2FFRj7UF0h 4eROC2SrFNSeyAzK X-Google-Smtp-Source: AGHT+IGn/WRKVrT82iGZgkf9/jp1T9k7GHzUIn3Wq3ZCorYLAnjeqsNRUFnIKIH67oVoVPLCROoorg== X-Received: by 2002:a25:6a02:0:b0:e44:82ef:397d with SMTP id 3f1490d57ef6-e538c20def6mr15858003276.6.1735411816812; Sat, 28 Dec 2024 10:50:16 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cc1e928sm5201774276.17.2024.12.28.10.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:15 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 11/14] scsi: lpfc: switch lpfc_irq_rebalance() to using cpumask_next_wrap() Date: Sat, 28 Dec 2024 10:49:43 -0800 Message-ID: <20241228184949.31582-12-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" Calling cpumask_next_wrap_old() with starting CPU equal to wrapping CPU is the same as request to find next CPU, wrapping around if needed. cpumask_next_wrap() is the proper replacement for that. Signed-off-by: Yury Norov Reviewed-by: Justin Tee --- drivers/scsi/lpfc/lpfc_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 31622fb0614a..e94a7b8973a7 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -12876,7 +12876,7 @@ lpfc_irq_rebalance(struct lpfc_hba *phba, unsigned = int cpu, bool offline) =20 if (offline) { /* Find next online CPU on original mask */ - cpu_next =3D cpumask_next_wrap_old(cpu, orig_mask, cpu, true); + cpu_next =3D cpumask_next_wrap(cpu, orig_mask); cpu_select =3D lpfc_next_online_cpu(orig_mask, cpu_next); =20 /* Found a valid CPU */ --=20 2.43.0 From nobody Sun May 10 07:13:39 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 EE56F19F41A; Sat, 28 Dec 2024 18:50:19 +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=1735411821; cv=none; b=Y1L5wjNvX1OZTBKbSp/LeL2Qmi+300KGMsmNfAVZNrAlPozzW1Mq//axdkgpiLvshYvkvq8hvmilX+BcziX34ObITB+oM4jN0voplIfEWIRzpKe5tWO7SN4dH1aFcdmmieHIv2E7kPWccsU0hnKMb6jmzDE9vnHmgLPd+KycbM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411821; c=relaxed/simple; bh=CCJtLFBCs6CKtlN21Jf8J9218bTM+KX7G7To006Rf3o=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HDE61zVLKhBIkLym52JgrsB4K/2LKOc3v0wRUtdo4m/FlfIdfpwfzYbOl9jiO0N1VDoXvp1ZjI8MOMa3gkUOfKg/SuOgSF8Xqcrtzit5DZAdNH/pITU6edGTpWrE3RyLCDjL3KOsbuMi4sEntfxQJeZEAw5g4lU103rrCFFuo/I= 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=nIGenw5z; 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="nIGenw5z" Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e53ef7462b6so4633666276.3; Sat, 28 Dec 2024 10:50:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411819; x=1736016619; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QHPIZAncAii6tgbh0wNxh85yAc7Gn1z/+3/HM+ibJUk=; b=nIGenw5zaGkJmAryzB3kQXm8+qNZZorrCRzWZyV5LH+/Uuh0ZTSp+f/V2rStzQ1yaZ fbv3ugUSlSPVgz0Hga5GYWf/bQFPdNw4O2u4XJIqC/Bdo1ln8dFrW8UnQeRZma5F1OB9 1OMfFn9LEvF8GuYy1CTCvsv+nLcc/TwFZZ0jzEIN1NABgwPVedujH1kFslAqenyQFKhH y6LHeKtCXTDU/dIL0V8zQYAGh3c5akZiNsYm+WC7DoAcnnriZeXanD7JiunhQ+K1FvWJ aqrTuCFldlBg+2zO4Br7clxLznEo4g0zJGvY7wDZB3+pdTEJiPJWpEdgwMUI06VUaaV3 ADSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411819; x=1736016619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QHPIZAncAii6tgbh0wNxh85yAc7Gn1z/+3/HM+ibJUk=; b=hZkR/zxBo0Z1JDWOFA45nsmmxtM7b33Z3QP2LrE2uhfN4fc4OnxCCrjEQtHSCq43Eb o2va0eOBMmNUhljLrBvjSZ26o4+R/bvAZTR1SyIjDr43HR7hGhK35DWZY7GErNe8S4EH cqAkMeFROv/vuPS7F3qndym9LG7JGCiKXtUYNzyXYiVZkQ4/8fiuA8pZzDljsMZaeFs/ Od0wKf51/xTARzIHIM1FzNG9poRzWefA5IIIZFnQdqkX/ZwSUFwIT5XYQB/8iE/MQzeO vkHQj730HsxmhFKg7jTbEc3VHZsDRZx+AfavIOeh9Vq610oSSrD61969NGi48BxqaeB0 A3Lg== X-Forwarded-Encrypted: i=1; AJvYcCUvaFUZIyy4W6Pe0z4w0WKKYzxFcqOjP2kxkOcoJWmJOkKV/Be2//G/WMsWVUyEADJxy+bhc9mae7leuvc=@vger.kernel.org X-Gm-Message-State: AOJu0YzyvEOi0OLwznRx9FHQ1f/JPw/hfg5vDY6qDijLtqX0/j1boDm9 XYvCVRH1Xi6kNHfwnRyFgVcXeS9aD2hQrCnEVscXW2XIM8/Vrg1gf9ZxxzkX X-Gm-Gg: ASbGncs4C4fY3EPb/bfpvJE04Wlrr9lcSmyL/lZQQPKXjZBIyAhxpDkEjGooWa3JrJg qNi8/3WZlZVoF2GiVEE3HtgEAwQ5y9CWimjLbeC9hY+v6SY9aVjEneMZzuBpFEWYUl8Scv0fhUO jtEMkxFuLcgRlXmlNagFsgitkRToyMGooxojTxsbyU/ZNi/Lih71wBpOw+rMCGr5XnWjY75fVL7 ZPDFqBQiwnXi6Odvf7sB/FGAQhYxlNMuwrmfKcyRS1elgvUN6OeUrsCSaOiAaAP/q6aXjwRY9HO IKsPKK6vNpS8Wq9K X-Google-Smtp-Source: AGHT+IHcVmQ8u7XvWW06STVtFjh0Z/K0WoYV9ZsBMGJX581Zr3/nYzYWbMrabkokE7DvE5bpKUWkOw== X-Received: by 2002:a25:21d7:0:b0:e3a:3c1a:3bef with SMTP id 3f1490d57ef6-e538c3a0018mr17151525276.36.1735411818952; Sat, 28 Dec 2024 10:50:18 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cf46c0dsm5057066276.43.2024.12.28.10.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:18 -0800 (PST) From: Yury Norov To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , Yury Norov , Rasmus Villemoes Subject: [PATCH 12/14] scsi: lpfc: rework lpfc_next_{online,present}_cpu() Date: Sat, 28 Dec 2024 10:49:44 -0800 Message-ID: <20241228184949.31582-13-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" lpfc_next_online_cpu() opencodes cpumask_next_and_wrap() by using a for-loop. Use it and make the lpfc_next_online_cpu() a plain one-liner. While there, rework lpfc_next_present_cpu() similarly. Notice that cpumask_next() followed by cpumask_first() in the worst case of an empty mask may traverse the mask twice. Cpumask_next_wrap() takes care of that correctly. Signed-off-by: Yury Norov Reviewed-by: Justin Tee --- drivers/scsi/lpfc/lpfc.h | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index e5a9c5a323f8..62438e84e52a 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1715,18 +1715,12 @@ lpfc_phba_elsring(struct lpfc_hba *phba) * Note: If no valid cpu found, then nr_cpu_ids is returned. * **/ -static inline unsigned int +static __always_inline unsigned int lpfc_next_online_cpu(const struct cpumask *mask, unsigned int start) { - unsigned int cpu_it; - - for_each_cpu_wrap(cpu_it, mask, start) { - if (cpu_online(cpu_it)) - break; - } - - return cpu_it; + return cpumask_next_and_wrap(start, mask, cpu_online_mask); } + /** * lpfc_next_present_cpu - Finds next present CPU after n * @n: the cpu prior to search @@ -1734,16 +1728,9 @@ lpfc_next_online_cpu(const struct cpumask *mask, uns= igned int start) * Note: If no next present cpu, then fallback to first present cpu. * **/ -static inline unsigned int lpfc_next_present_cpu(int n) +static __always_inline unsigned int lpfc_next_present_cpu(int n) { - unsigned int cpu; - - cpu =3D cpumask_next(n, cpu_present_mask); - - if (cpu >=3D nr_cpu_ids) - cpu =3D cpumask_first(cpu_present_mask); - - return cpu; + return cpumask_next_wrap(n, cpu_present_mask); } =20 /** --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (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 0FBD81A00F8; Sat, 28 Dec 2024 18:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411823; cv=none; b=jz4EpvYyQgPkUh/l/YQxsLOTrg1weroKpXksfIVnwp163M9db3qBQmpl7aBV4BYXVH1f5PpX8TChluKo37KltBD31qDdtZ2W7AQm2CCOZQmeNcMgaaUal9dN9l33RDCjSjKoyazng+6PVtOW5wbj6hqeMk9ITqNxVeGh17MoKBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411823; c=relaxed/simple; bh=iW9ylujeTdndT37/iM7oaUQu1ZpcpSzb4qLxy9BPmQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dtjGxmTROAs0eGTmdkmbhVVVeGPIh6DvoE6Oc6bVudHf6c8vsMF05qXxqEV2RzybHtyFTmemPMaL1wK1Q9Xwrl+ZL2Bs6EZFMHh3PClTh4RZ4V7HlGzbIGXnbD9sIwqRd4+882z+xTC1p0nJzah+FaqHdnRy3vB24WgopezoJyU= 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=Av5U7meb; arc=none smtp.client-ip=209.85.219.181 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="Av5U7meb" Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-e398484b60bso8677342276.1; Sat, 28 Dec 2024 10:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411821; x=1736016621; 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=0OLhVdLNIy86InjJpjUKoLKMqO34Ru2M3pMOZX0/BuM=; b=Av5U7meb/h9zYMV0VA43DnuVDG+OIdsKCMKbsToFnECDo6zaon2D3Kr1z4EsJ2qXA1 RE6kEJfuOWdhYJNg1wY4USxkjDaelkbOyMKPlby3U8xYR4Y6wvIxKLvmR94372bO60+j NcDGzBic0ttjPtHqaukJkuXYDH6fUVmw9TtxdSXtleQyfWFc8ySUypTamfosfutvmai2 kMRTaHxztwtowqr3szoYo0ElJ4oIS80NsHeLYVwIEyyy/KcfQ4sMfdyeuMRp2l5Yg3/B yFZCZSQ7TdWjK/ID/j3D2R1f8EPc14Omr0HgqprUvXCY5e0jl5RqE8uDgEk7PGrmCl9K wrKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411821; x=1736016621; 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=0OLhVdLNIy86InjJpjUKoLKMqO34Ru2M3pMOZX0/BuM=; b=GWCc4Kf72JAW9IHEBg/+sY4V2sfWDQfbUpSNRdZmsJeozRYHRC6auIO0IVGGiCweg4 IkavztH0Ke4vIklx8XcLgXTkM1Vb/eNnMecvAWu0LWpDeQgKEV57pBtTrkcw8uY8awYL nv5Gg5QVy87SFk5Q0kq2uzMcRsbBW9K4iSVkV7zT5EJ332htGq+6Y0qJ+Vc/WCDC121A opjouFZW/C5aALIaIA6LE+wcmam5E5bmzj9HxN6ZMwnlIXbePIWjy2trymUxak6NE2Qd iqYZTpIMkxGN3zNem+aHG1qWiBovssukGRQ0k9xu3x0DosULmK1mxOr+aCxd3yljaLew lx5w== X-Forwarded-Encrypted: i=1; AJvYcCU+DmxbRm1/UwVfiIn4uYka/Q/7U6vvaTNLfxM/Zok3AYu+M8XOfiuKtqAtINnJ6/EwTECITKUFOVdMsSE=@vger.kernel.org, AJvYcCV1eYuMv4SQQsRPjBv1Ia44/guhXGaUEJv6DHjMI6pMPngCNkte+p9MqutLA5YyujWar1rqUm+taiWQ@vger.kernel.org X-Gm-Message-State: AOJu0YwCXtH9JzoaJk1/EJR0GXUC1sqnpOWMskx/wqX7J0ZlvoSJW5NF mjsw3MVDF4YC+U3MeJ0yAUdUps8Vsb45FkhU8yMLFtBoH4S72OQvVLseky5s X-Gm-Gg: ASbGncuTkHaqT7G5UWWSAOT4a9nrjedpcikCuUigEAhsxHNdDhVX0uNh/9Zj2yCpYYK eLepMHGf5A4LjwpMWtfJ6UU5NXVAQimSns4bLhUIdCdh/XMWB31WTf/rlcZKRx84da0OfcR0apZ V5qKi3qgp9WPKxlwnLVNtVkIbwH6QIQXnaAoyVvv7cd0F0wHSANhIpEO+38vcN7tJn2ZS/CQMXO AsnwGOafuaGcjQ8rIformfuLopng6R5p1CVLEOUe+dV4wg+0+890IGMX+RFeKu+7VMwvDGMO5dt /ub6W+W3mGvLgCXH X-Google-Smtp-Source: AGHT+IFcN0Go12HlexbfvKdqPGehFZUpfM2D5CjlN3akVq3/w+FTn+K4qrCtvr5d4IqwedfN8cLy+A== X-Received: by 2002:a05:690c:490c:b0:6e2:43ea:552 with SMTP id 00721157ae682-6f3f8110ed5mr204402267b3.16.1735411821056; Sat, 28 Dec 2024 10:50:21 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f3e743ba07sm47965447b3.28.2024.12.28.10.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:19 -0800 (PST) From: Yury Norov To: linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas Cc: Yury Norov , Rasmus Villemoes Subject: [PATCH 13/14] PCI: hv: switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap() Date: Sat, 28 Dec 2024 10:49:45 -0800 Message-ID: <20241228184949.31582-14-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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" Calling cpumask_next_wrap_old() with starting CPU =3D=3D nr_cpu_ids is effectively the same as request to find first CPU, starting from a given one and wrapping around if needed. cpumask_next_wrap() is a proper replacement for that. Signed-off-by: Yury Norov Acked-by: Bjorn Helgaas --- drivers/pci/controller/pci-hyperv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/p= ci-hyperv.c index 86d1c2be8eb5..f8ebf98248b3 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1757,8 +1757,7 @@ static int hv_compose_multi_msi_req_get_cpu(void) =20 spin_lock_irqsave(&multi_msi_cpu_lock, flags); =20 - cpu_next =3D cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids, - false); + cpu_next =3D cpumask_next_wrap(cpu_next, cpu_online_mask); cpu =3D cpu_next; =20 spin_unlock_irqrestore(&multi_msi_cpu_lock, flags); --=20 2.43.0 From nobody Sun May 10 07:13:39 2026 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 4038C1A08C4 for ; Sat, 28 Dec 2024 18:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411826; cv=none; b=fu4yMGJV1AxGdD3LpbiZpIBIT7RG4WgrHcybugkHU0e+ZbeiTWYFqUlVcV3oKCcq8YeUjQBfrivFKH9dzlLgg2SlwVqiqgVX2wl2HZyikdJCxpyUb9JotqBA3HBXLRh+p89V79TBY5F99lmYR0fqlbCUf3I3uhgoh1f6woeReLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735411826; c=relaxed/simple; bh=oBgQJD9Ty1IzfEygnsGTGDgqza7lkMcdboAeaVonfg4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fShRzcp0QLzePutTyh3VV4MDQHQNEczIfoEONz/NILtHQuTZ5cmRPXf2t2N6k4VDlkc7wIUrwAMF3kiOSmU82ileqMRE2Biy0WQuLu5T44QT4YHeG58/uyDj8LvIlviAcxZr+pT5fSTd6bbzZIycxwILNAFzVMztFfYCmmMW+c8= 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=YX+NSK+7; arc=none smtp.client-ip=209.85.219.176 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="YX+NSK+7" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e53aa843a24so7581706276.0 for ; Sat, 28 Dec 2024 10:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735411824; x=1736016624; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=x+tjauzfTAqaveSfzn1e+mhO9J6NkwE5NNr0Zl9Ec9o=; b=YX+NSK+7CE87egEaA+iEOysdreNoDlzYttKu8irIZcB7fDTQhJe0bAqakFL4bDEAnE MA3dANK87O6s6Us2ETrWDwjU6rEU3kNMI1sVeEH2a9cD4GgnxJcJOokSuBD2iRS5LF8N J9wHs2Eo191fLLgFp10jFVmSRv/3eAqr30pja9ovcuyr7YBfGRn0IsxYhAYNIaE3AKM1 B/HgtxVQf1oOMjFBkzJR4IGaPDatqhmcoupxlRU90azh7TqDW3SQiTFcdai12IEI6e+L Kh3+kg9jx9ERPBmBZMgjeRtlKk4CtIFgUBM8PwY4GNoBP0EaeUCh0nZz5/X8V1uXG0tK rkOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735411824; x=1736016624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x+tjauzfTAqaveSfzn1e+mhO9J6NkwE5NNr0Zl9Ec9o=; b=jbD8VgFWeBlLIRt504mNVV7hvytXirrdbIyabxJeMgXZc61a8JzvyP/IST9QHlM8Q4 Sm4hLExkpuljlpeVr6f4rkA65Kr7ZpZ0BSd8/T9b8atCLyQJEpZ9p4S4/ojCmna4eu2Y IchFnsJT/tXwsVuVHVuIGG7IEPTJkyYpSKAjnBkrad59vT1RtCUcLphj+Sd8DC4MjrX3 +/lXzv+eqDEJH67yn1SU9RksDsOw4L6QNIPWIIXeqYYo0os1fYgvbaKzGkkihAlLDWU7 6Sf6S3WN700mDiB8JYhlFp5JSNA67QILwyaYHofLWdP4b5ktUpeDjRyB/JCeDNil957/ 0F2A== X-Gm-Message-State: AOJu0Yx/4zOR4NH1DwVJKo3TNYZZWVeDiUM4u4wPZk5CIOfnra2idN0k UL9/F4wNZT/gUsNk7j6qsMVk6DspCOctODlVxa2z0A1TWQaWy1i3OofuwQxJ X-Gm-Gg: ASbGncuQ0Ib4lsm1a/yEOarStplGAYC4eGidOx87nxhG6qWYvjcHpAOxhASvxQV3zpo JjzgB7C8LQphM8zDIpn+5RBGCOdPkz8A2AAhjwCpwWMwyWeulH8idWAAwLrO9Yc3QOcndh1HaSA lhZ0HEcR7b4LFTnsVSN9TyaGrVyCGOlTu6l2iXT2tZWRUPHZWzmu/dEtJeyFeBkjzn31locXHVv NfBLOChhLRu4X6hihXEYdUGrzJf006MyORr9d40Sk1hpjRI9IIaVQyjW5vpkDQZ4Ns29RMesBC6 W/YdVSfefjVAttYB X-Google-Smtp-Source: AGHT+IGUf9tLCUNZYTKrVtkz4yPb9icPWf+cRKS4+JCdUq3uGP1F9BvsT4jjBbosKBwPbn1+5rkQyQ== X-Received: by 2002:a05:6902:218e:b0:e38:f2ef:4f6 with SMTP id 3f1490d57ef6-e538cd1a8camr22959273276.7.1735411824099; Sat, 28 Dec 2024 10:50:24 -0800 (PST) Received: from localhost (c-24-129-28-254.hsd1.fl.comcast.net. [24.129.28.254]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e537cc7914esm5087807276.31.2024.12.28.10.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:50:22 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, Yury Norov , Rasmus Villemoes , Andrew Morton Subject: [PATCH 14/14] cpumask: drop cpumask_next_wrap_old() Date: Sat, 28 Dec 2024 10:49:46 -0800 Message-ID: <20241228184949.31582-15-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241228184949.31582-1-yury.norov@gmail.com> References: <20241228184949.31582-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 we have cpumask_next_wrap() wired to generic find_next_bit_wrap(), the old implementation is not needed. Signed-off-by: Yury Norov --- include/linux/cpumask.h | 21 --------------------- lib/cpumask.c | 32 -------------------------------- 2 files changed, 53 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index d9a3d0ea2df1..80fa8c9bfa68 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -311,27 +311,6 @@ unsigned int cpumask_next_wrap(int n, const struct cpu= mask *src) #define for_each_cpu(cpu, mask) \ for_each_set_bit(cpu, cpumask_bits(mask), small_cpumask_bits) =20 -#if NR_CPUS =3D=3D 1 -static __always_inline -unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int = start, bool wrap) -{ - cpumask_check(start); - if (n !=3D -1) - cpumask_check(n); - - /* - * Return the first available CPU when wrapping, or when starting before = cpu0, - * since there is only one valid option. - */ - if (wrap && n >=3D 0) - return nr_cpumask_bits; - - return cpumask_first(mask); -} -#else -unsigned int __pure cpumask_next_wrap_old(int n, const struct cpumask *mas= k, int start, bool wrap); -#endif - /** * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a spe= cified location * @cpu: the (optionally unsigned) integer iterator diff --git a/lib/cpumask.c b/lib/cpumask.c index d7cce2aaebc2..fbf7630f2ac9 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -7,38 +7,6 @@ #include #include =20 -/** - * cpumask_next_wrap_old - helper to implement for_each_cpu_wrap - * @n: the cpu prior to the place to search - * @mask: the cpumask pointer - * @start: the start point of the iteration - * @wrap: assume @n crossing @start terminates the iteration - * - * Return: >=3D nr_cpu_ids on completion - * - * Note: the @wrap argument is required for the start condition when - * we cannot assume @start is set in @mask. - */ -unsigned int cpumask_next_wrap_old(int n, const struct cpumask *mask, int = start, bool wrap) -{ - unsigned int next; - -again: - next =3D cpumask_next(n, mask); - - if (wrap && n < start && next >=3D start) { - return nr_cpumask_bits; - - } else if (next >=3D nr_cpumask_bits) { - wrap =3D true; - n =3D -1; - goto again; - } - - return next; -} -EXPORT_SYMBOL(cpumask_next_wrap_old); - /* These are not inline because of header tangles. */ #ifdef CONFIG_CPUMASK_OFFSTACK /** --=20 2.43.0