Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1335122pxj; Sat, 12 Jun 2021 05:39:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnnwlAMmP0Lp0E0rI3FRAjgoWdGFqseFrCz4q0V53CEyjxo6Pnkgxa27hXFY23/JjimtlT X-Received: by 2002:a17:906:c0c7:: with SMTP id bn7mr7557782ejb.393.1623501575620; Sat, 12 Jun 2021 05:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623501575; cv=none; d=google.com; s=arc-20160816; b=aZLVuMnZmS+4HXwVZDA8P25qzBAoZYRRBmZr/YjO9dI24sj3clGsrEFH6hVYlMoqED 5av6bL6UoNjqutRV4/7rzt2S28wsiVzkBOdMfr3fqeFn7vHWOoJs/TLC9v9WPhtpwti9 xkw6FbQhCgan8mcTjG3+mS08vAKYJqxi4ewBzzCqo+YWSk0sa3AJQpCLsF5gxcCFf/PP 9bUJeoGkVHh21Pm9qmi0CbnsWTcjclUoXd8nXdfDNR/rQ4cC/o46GksOSunBEy0J3D3L kIl7QHTH3WQ399dxClMazyhYuGmYn0yNzfhhuswac0CLGdYa1mLX4vpbYMxvL8LCk7d9 Fdlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pGYip1TYwkBVOq/t4svj5wGlh/+ScwbEreTBrPkXi/s=; b=glo5SGwHhykA1a/o8178Ke65E9hgoas0NSiCIS5SXnkiiuKmh5QTYhRJr+glIAEa+p 4dUv056tM9ZAhZGKt9JIViI2FWX9A7iYfPcgEotnwccGLMHoiXUv12HPKpUAWlhBNitU 4vEMBetC8wsJ6ZGpGKB9oFloc9xgklrGw9O4wnyth6/O0crophcLHSDE1i490Sin+Ijt r5UsVjLcKipQFuqXw68o8oVUshCg/pyrhRLK88jtmJP4kaqOYSypMQblR51cOB/Y7M/7 sy3h8lwTPpZeNrqIQiL0i2d8+KLfiaF5pJ1t7dxza4onWaLGfs2kDQTPksDwR1ihtY3e Tp2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qwxBASDf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si6737940edd.408.2021.06.12.05.39.13; Sat, 12 Jun 2021 05:39:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qwxBASDf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbhFLMkS (ORCPT + 99 others); Sat, 12 Jun 2021 08:40:18 -0400 Received: from mail-qv1-f46.google.com ([209.85.219.46]:37454 "EHLO mail-qv1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbhFLMkH (ORCPT ); Sat, 12 Jun 2021 08:40:07 -0400 Received: by mail-qv1-f46.google.com with SMTP id x6so13118389qvx.4; Sat, 12 Jun 2021 05:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pGYip1TYwkBVOq/t4svj5wGlh/+ScwbEreTBrPkXi/s=; b=qwxBASDfdCZdFScmA/IVTIh3Wyvgvef/wR69EcmQD6bijDwtjo3RoOefxXv50wpFr9 cPyg3bGdSldG8wwrypkfUO9DeImQWy3pa/WoW1Ad7AgPVgaHOykhTJP/sXqr+sO2m/1U s9gNXBFuSnfXF7aS4ZkCxRySwRuz25DHjQXlwyW1Xef8/4ygpr8jgpCbDJnUxwu8pHB3 TzXjWBJG5L3nqu1VQtLSdy/zO1HduzZpzHFJ6efZ2TZn9H7J4UF82/zkVYf9EAofWwSx dhyj0shH+JrVz3p3jDU0UolboiyAWAw0oT9Tzxs2+J9PF+/vNK9gDKbW16VL0qBlWD2v trLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pGYip1TYwkBVOq/t4svj5wGlh/+ScwbEreTBrPkXi/s=; b=fxNDVWgT9W7mWVOZ4bFCpH3a5DH6stHrEgeb0oI8PHzJRGQfY8GQ0Us4iozbyCsCAS NnVcLEias0uTAfBM2UAQyTFAizSVyX78etVlJmB2LeZsKKiEkPlqpnRlfIUxMkU+kP6B 8syNaGpc+6GlgIQ538yrDn/WKKJ/Px12b3xn5zsBE6jxWlsLZeDHueYk/RC8kDWqZqkA c38dQqquXCANimyrS/UxpEx9yXKXNrZvEfsj0YPIA6qUjMmhnGr3VOv8lcClUsjtD2Bq j4Kd9fPyWaCA2GEvsC8KEf2hAx8MM2COA4ZjZKsgtOUWh16QMynVDBCSgxowb89a+4Nz elVA== X-Gm-Message-State: AOAM5321YcZCsVAjdOkGfBA0VPCPqDZwziwtMrq+vCb35V+6AHEU4rtC E7NoNAjf7dg4JCO8CobkXW8K+XG2OUaD5Q== X-Received: by 2002:a05:6214:1909:: with SMTP id er9mr9371442qvb.13.1623501411544; Sat, 12 Jun 2021 05:36:51 -0700 (PDT) Received: from localhost ([70.127.84.75]) by smtp.gmail.com with ESMTPSA id f130sm6434285qke.37.2021.06.12.05.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Jun 2021 05:36:51 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Benjamin Herrenschmidt , Catalin Marinas , Will Deacon , Yoshinori Sato , Brian Cain , Geert Uytterhoeven , Thomas Bogendoerfer , Jonas Bonn , Stefan Kristiansson , "James E.J. Bottomley" , Palmer Dabbelt , Heiko Carstens , Rich Felker , David Hildenbrand , Jaegeuk Kim , Arnd Bergmann , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , Alexander Lobakin , Samuel Mendoza-Jonas , Jakub Kicinski , Daniel Bristot de Oliveira , Alexey Klimov , Ingo Molnar Cc: Yury Norov Subject: [PATCH 6/8] cpumask: use find_first_and_bit() Date: Sat, 12 Jun 2021 05:36:37 -0700 Message-Id: <20210612123639.329047-7-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210612123639.329047-1-yury.norov@gmail.com> References: <20210612123639.329047-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now we have an efficient implementation for find_first_and_bit(), so switch cpumask to use it where appropriate. Signed-off-by: Yury Norov --- include/linux/cpumask.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index bfc4690de4f4..6bee58600946 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -123,6 +123,12 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp) return 0; } +static inline unsigned int cpumask_first_and(const struct cpumask *srcp1, + const struct cpumask *srcp2) +{ + return 0; +} + static inline unsigned int cpumask_last(const struct cpumask *srcp) { return 0; @@ -167,7 +173,7 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node) static inline int cpumask_any_and_distribute(const struct cpumask *src1p, const struct cpumask *src2p) { - return cpumask_next_and(-1, src1p, src2p); + return cpumask_first_and(src1p, src2p); } static inline int cpumask_any_distribute(const struct cpumask *srcp) @@ -195,6 +201,19 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp) return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits); } +/** + * cpumask_first_and - return the first cpu from *srcp1 & *srcp2 + * @src1p: the first input + * @src2p: the second input + * + * Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and(). + */ +static inline +unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask *srcp2) +{ + return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), nr_cpumask_bits); +} + /** * cpumask_last - get the last CPU in a cpumask * @srcp: - the cpumask pointer @@ -585,15 +604,6 @@ static inline void cpumask_copy(struct cpumask *dstp, */ #define cpumask_any(srcp) cpumask_first(srcp) -/** - * cpumask_first_and - return the first cpu from *srcp1 & *srcp2 - * @src1p: the first input - * @src2p: the second input - * - * Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and(). - */ -#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p)) - /** * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2 * @mask1: the first input cpumask -- 2.30.2