lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20221111040027.621646-3-yury.norov@gmail.com> Date: Thu, 10 Nov 2022 20:00:25 -0800 From: Yury Norov <yury.norov@...il.com> To: linux-kernel@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Barry Song <baohua@...nel.org>, Ben Segall <bsegall@...gle.com>, Daniel Bristot de Oliveira <bristot@...hat.com>, Dietmar Eggemann <dietmar.eggemann@....com>, Gal Pressman <gal@...dia.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Heiko Carstens <hca@...ux.ibm.com>, Ingo Molnar <mingo@...hat.com>, Jakub Kicinski <kuba@...nel.org>, Jason Gunthorpe <jgg@...dia.com>, Jesse Brandeburg <jesse.brandeburg@...el.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>, Juri Lelli <juri.lelli@...hat.com>, Leon Romanovsky <leonro@...dia.com>, Mel Gorman <mgorman@...e.de>, Peter Zijlstra <peterz@...radead.org>, Rasmus Villemoes <linux@...musvillemoes.dk>, Saeed Mahameed <saeedm@...dia.com>, Steven Rostedt <rostedt@...dmis.org>, Tariq Toukan <tariqt@...dia.com>, Tariq Toukan <ttoukan.linux@...il.com>, Tony Luck <tony.luck@...el.com>, Valentin Schneider <vschneid@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org> Cc: Yury Norov <yury.norov@...il.com>, linux-crypto@...r.kernel.org, netdev@...r.kernel.org, linux-rdma@...r.kernel.org Subject: [PATCH 2/4] cpumask: introduce cpumask_nth_and_andnot() Introduce cpumask_nth_and_andnot() based on find_nth_and_andnot_bit(). It's used in the following patch to traverse cpumasks without storing intermediate result in temporary cpumask. Signed-off-by: Yury Norov <yury.norov@...il.com> --- include/linux/cpumask.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index c2aa0aa26b45..debfa2261569 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -391,6 +391,26 @@ unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1, nr_cpumask_bits, cpumask_check(cpu)); } +/** + * cpumask_nth_and_andnot - get the Nth cpu set in 1st and 2nd cpumask, and clear in 3rd. + * @srcp1: the cpumask pointer + * @srcp2: the cpumask pointer + * @srcp3: the cpumask pointer + * @cpu: the N'th cpu to find, starting from 0 + * + * Returns >= nr_cpu_ids if such cpu doesn't exist. + */ +static inline +unsigned int cpumask_nth_and_andnot(unsigned int cpu, const struct cpumask *srcp1, + const struct cpumask *srcp2, + const struct cpumask *srcp3) +{ + return find_nth_and_andnot_bit(cpumask_bits(srcp1), + cpumask_bits(srcp2), + cpumask_bits(srcp3), + nr_cpumask_bits, cpumask_check(cpu)); +} + #define CPU_BITS_NONE \ { \ [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \ -- 2.34.1
Powered by blists - more mailing lists