From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit Now that cpumask_next{_and}_wrap() is wired to generic find_next_bit_wrap(), we can use it in cpumask_any{_and}_distribute(). This automatically makes the cpumask_*_distribute() functions to use small_cpumask_bits instead of nr_cpumask_bits, which itself is a good optimization. Signed-off-by: Yury Norov --- lib/cpumask.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/cpumask.c b/lib/cpumask.c index c9a9b451772a..d7cce2aaebc2 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -174,8 +174,7 @@ unsigned int cpumask_any_and_distribute(const struct cpumask *src1p, /* NOTE: our first selection will skip 0. */ prev = __this_cpu_read(distribute_cpu_mask_prev); - next = find_next_and_bit_wrap(cpumask_bits(src1p), cpumask_bits(src2p), - nr_cpumask_bits, prev + 1); + next = cpumask_next_and_wrap(prev, src1p, src2p); if (next < nr_cpu_ids) __this_cpu_write(distribute_cpu_mask_prev, next); @@ -195,7 +194,7 @@ unsigned int cpumask_any_distribute(const struct cpumask *srcp) /* NOTE: our first selection will skip 0. */ prev = __this_cpu_read(distribute_cpu_mask_prev); - next = find_next_bit_wrap(cpumask_bits(srcp), nr_cpumask_bits, prev + 1); + next = cpumask_next_wrap(prev, srcp); if (next < nr_cpu_ids) __this_cpu_write(distribute_cpu_mask_prev, next); -- 2.43.0