Re: [PATCH v4 00/40] lib/find: add atomic find_bit() primitives

2024-06-20 Thread Yury Norov
On Thu, Jun 20, 2024 at 12:26:18PM -0700, Linus Torvalds wrote: > On Thu, 20 Jun 2024 at 11:32, Yury Norov wrote: > > > > Is that in master already? I didn't get any email, and I can't find > > anything related in the master branch. > > It's 5d272dd1b

Re: [PATCH v4 00/40] lib/find: add atomic find_bit() primitives

2024-06-20 Thread Yury Norov
On Thu, Jun 20, 2024 at 11:00:38AM -0700, Linus Torvalds wrote: > On Thu, 20 Jun 2024 at 10:57, Yury Norov wrote: > > > > > > The typical lock-protected bit allocation may look like this: > > If it looks like this, then nobody cares. Clearly the user in question &

[PATCH v4 01/40] lib/find: add atomic find_bit() primitives

2024-06-20 Thread Yury Norov
C: Bart Van Assche CC: Sergey Shtylyov Signed-off-by: Yury Norov --- MAINTAINERS | 1 + include/linux/find.h| 4 - include/linux/find_atomic.h | 324 lib/find_bit.c | 86 ++ 4 files changed, 411 insertions(+),

[PATCH v4 02/40] lib/find: add test for atomic find_bit() ops

2024-06-20 Thread Yury Norov
Add basic functionality test for new API. Signed-off-by: Yury Norov --- lib/test_bitmap.c | 62 +++ 1 file changed, 62 insertions(+) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 65a75d58ed9e..405f79dd2266 100644 --- a/lib/test_bitmap.c

[PATCH v4 00/40] lib/find: add atomic find_bit() primitives

2024-06-20 Thread Yury Norov
move new API to separate headers, to not bloat bitmap.h @ Linus; - patch #1: adjust comments to allow returning >= @size; - rebase the series on top of current master. Yury Norov (40): lib/find: add atomic find_bit() primitives lib/find: add test for atomic find_bit() ops l

[PATCH v4 40/40] powerpc/xive: drop locking around IRQ map

2024-06-20 Thread Yury Norov
The code operates on individual bits of the bitmap, and leveraging atomic find ops we can drop locking scheme around the map. Signed-off-by: Yury Norov --- arch/powerpc/sysdev/xive/spapr.c | 34 ++-- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/arch

[PATCH v4 37/40] KVM: PPC: Book3s HV: drop locking around kvmppc_uvmem_bitmap

2024-06-20 Thread Yury Norov
The driver operates on individual bits of the kvmppc_uvmem_bitmap. Now that we have an atomic search API for bitmaps, we can rely on it and drop locking around the bitmap entirely. Signed-off-by: Yury Norov --- arch/powerpc/kvm/book3s_hv_uvmem.c | 33 ++ 1 file

[PATCH v4 18/40] powerpc: optimize arch code by using atomic find_bit() API

2024-06-20 Thread Yury Norov
Use find_and_{set,clear}_bit() where appropriate and simplify the logic. Signed-off-by: Yury Norov --- arch/powerpc/mm/book3s32/mmu_context.c | 11 +++--- arch/powerpc/platforms/pasemi/dma_lib.c| 46 ++ arch/powerpc/platforms/powernv/pci-sriov.c | 13 ++ 3 files

Re: [PATCH v6 3/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers

2024-03-07 Thread Yury Norov
On Thu, Mar 7, 2024, 2:31 AM Herve Codina wrote: > Hi Yury, > > On Wed, 6 Mar 2024 15:39:06 +0200 > Andy Shevchenko wrote: > > > On Wed, Mar 06, 2024 at 05:11:19AM -0800, Yury Norov wrote: > > > On Wed, Mar 06, 2024 at 09:07:19AM +0100, Herve Codina wrote: >

Re: [PATCH v6 1/5] net: wan: Add support for QMC HDLC

2024-03-06 Thread Yury Norov
On Wed, Mar 06, 2024 at 09:07:17AM +0100, Herve Codina wrote: > The QMC HDLC driver provides support for HDLC using the QMC (QUICC > Multichannel Controller) to transfer the HDLC data. > > Signed-off-by: Herve Codina > Reviewed-by: Christophe Leroy > Acked-by: Jakub Kicinski > Reviewed-by: Andy

Re: [PATCH v6 3/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers

2024-03-06 Thread Yury Norov
t; bitmap_gather() can the seen as the reverse bitmap_scatter() operation. > > Signed-off-by: Andy Shevchenko > Link: > https://lore.kernel.org/lkml/20230926052007.3917389-3-andriy.shevche...@linux.intel.com/ > Co-developed-by: Herve Codina > Signed-off-by: Herve Codina Signed

Re: [PATCH v6 4/5] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support

2024-03-06 Thread Yury Norov
On Wed, Mar 06, 2024 at 09:07:20AM +0100, Herve Codina wrote: > QMC channels support runtime timeslots changes but nothing is done at > the QMC HDLC driver to handle these changes. > > Use existing IFACE ioctl in order to configure the timeslots to use. > > Signed-off-by: Herve Codina > Reviewed

Re: [PATCH v4 3/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers

2024-02-22 Thread Yury Norov
On Thu, Feb 22, 2024 at 05:49:59PM +0100, Herve Codina wrote: > Hi Andy, Yury, > > On Thu, 22 Feb 2024 17:39:27 +0200 > Andy Shevchenko wrote: > > ... > > > + * bitmap_scatter() for the bitmap scatter detailed operations). > > > > > + * Suppose scattered computed using bitmap_scatter(scattere

Re: [PATCH v3 RESEND 3/6] bitmap: Make bitmap_onto() available to users

2024-02-12 Thread Yury Norov
On Mon, Feb 12, 2024 at 04:36:36PM +0200, Andy Shevchenko wrote: > On Mon, Feb 12, 2024 at 03:20:22PM +0100, Herve Codina wrote: > > On Mon, 12 Feb 2024 16:01:38 +0200 > > Andy Shevchenko wrote: > > ... > > > Agree, the bitmap_onto() code is simpler to understand than its help. > > > > I introd

Re: [PATCH v3 RESEND 4/6] bitmap: Introduce bitmap_off()

2024-02-12 Thread Yury Norov
On Mon, Feb 12, 2024 at 10:37:18AM -0800, Yury Norov wrote: > On Mon, Feb 12, 2024 at 08:56:32AM +0100, Herve Codina wrote: > > The bitmap_onto() function translates one bitmap relative to another but > > no function are present to perform the reverse translation. > > >

Re: [PATCH v3 RESEND 4/6] bitmap: Introduce bitmap_off()

2024-02-12 Thread Yury Norov
On Mon, Feb 12, 2024 at 08:56:32AM +0100, Herve Codina wrote: > The bitmap_onto() function translates one bitmap relative to another but > no function are present to perform the reverse translation. > > Introduce bitmap_off() to fill this hole. > > Signed-off-by: Herve Codina > --- > include/li

Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id

2024-01-24 Thread Yury Norov
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote: > On Tue, 23 Jan 2024, Huang Shijie wrote: > > > During the kernel booting, the generic cpu_to_node() is called too early in > > arm64, powerpc and riscv when CONFIG_NUMA is enabled. > > > > For arm64/powerpc/riscv, there are a

Re: [PATCH] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id

2024-01-19 Thread Yury Norov
On Fri, Jan 19, 2024 at 04:50:53PM +0800, Shijie Huang wrote: > > 在 2024/1/19 16:42, Mike Rapoport 写道: > > On Fri, Jan 19, 2024 at 02:46:16PM +0800, Shijie Huang wrote: > > > 在 2024/1/19 12:42, Yury Norov 写道: > > > > This adds another level of indirectio

Re: [PATCH] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id

2024-01-18 Thread Yury Norov
On Fri, Jan 19, 2024 at 11:32:27AM +0800, Huang Shijie wrote: > hZ7bkEvc+Z19RHkS/HVG3KMg > X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB7144 > Status: O > Content-Length: 3779 > Lines: 126 > > During the kernel booting, the generic cpu_to_node() is called too early in > arm64, power

Re: [PATCH v3 00/35] bitops: add atomic find_bit() operations

2023-12-16 Thread Yury Norov
On Mon, Dec 11, 2023 at 06:27:14PM -0800, Yury Norov wrote: > Add helpers around test_and_{set,clear}_bit() that allow to search for > clear or set bits and flip them atomically. > > The target patterns may look like this: > > for (idx = 0; idx < nbits; idx+

[PATCH v3 01/35] lib/find: add atomic find_bit() primitives

2023-12-11 Thread Yury Norov
tion with 'for_each'. CC: Bart Van Assche CC: Sergey Shtylyov Signed-off-by: Yury Norov --- include/linux/find.h | 293 +++ lib/find_bit.c | 85 + 2 files changed, 378 insertions(+) diff --git a/include/linux/find.h b/include

[PATCH v3 02/35] lib/find: add test for atomic find_bit() ops

2023-12-11 Thread Yury Norov
Add basic functionality test for new API. Signed-off-by: Yury Norov --- lib/test_bitmap.c | 61 +++ 1 file changed, 61 insertions(+) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 65f22c2578b0..277e1ca9fd28 100644 --- a/lib/test_bitmap.c

[PATCH v3 00/35] bitops: add atomic find_bit() operations

2023-12-11 Thread Yury Norov
@ Vitaly Kuznetsov, Sean Christopherson; Yury Norov (35): lib/find: add atomic find_bit() primitives lib/find: add test for atomic find_bit() ops lib/sbitmap; optimize __sbitmap_get_word() by using find_and_set_bit() watch_queue: optimize post_one_notification() by using find_and_

[PATCH v3 18/35] powerpc: optimize arch code by using atomic find_bit() API

2023-12-11 Thread Yury Norov
Use find_and_{set,clear}_bit() where appropriate and simplify the logic. Signed-off-by: Yury Norov --- arch/powerpc/mm/book3s32/mmu_context.c | 10 ++--- arch/powerpc/platforms/pasemi/dma_lib.c| 45 +- arch/powerpc/platforms/powernv/pci-sriov.c | 12 ++ 3 files

Re: [PATCH v2 00/35] bitops: add atomic find_bit() operations

2023-12-05 Thread Yury Norov
On Mon, Dec 04, 2023 at 07:51:01PM +0100, Jan Kara wrote: > Hello Yury! > > On Sun 03-12-23 11:23:47, Yury Norov wrote: > > Add helpers around test_and_{set,clear}_bit() that allow to search for > > clear or set bits and flip them atomically. > > > > The t

[PATCH v2 02/35] lib/find: add test for atomic find_bit() ops

2023-12-03 Thread Yury Norov
Add basic functionality test for new API. Signed-off-by: Yury Norov --- lib/test_bitmap.c | 61 +++ 1 file changed, 61 insertions(+) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 65f22c2578b0..277e1ca9fd28 100644 --- a/lib/test_bitmap.c

[PATCH v2 01/35] lib/find: add atomic find_bit() primitives

2023-12-03 Thread Yury Norov
or_each'. All users of find_bit() API, where heavy concurrency is expected, are encouraged to switch to atomic find_and_bit() as appropriate. CC: Bart Van Assche CC: Sergey Shtylyov Signed-off-by: Yury Norov --- include/linux/find.h | 293 +++ lib/fin

[PATCH v2 00/35] bitops: add atomic find_bit() operations

2023-12-03 Thread Yury Norov
atch #13: keep test against stimer->config.enable @ Vitaly Kuznetsov; - Patch #15: use find_and_set_next_bit @ Bart Van Assche; - Patch #31: edit commit message @ Tony Lu, Alexandra Winter; - Patch #35: edit tag @ John Paul Adrian Glaubitz; Yury Norov (35): lib/find: add atomic find_bit() primi

[PATCH v2 18/35] powerpc: use atomic find_bit() API where appropriate

2023-12-03 Thread Yury Norov
Use find_and_{set,clear}_bit() where appropriate and simplify the logic. Signed-off-by: Yury Norov --- arch/powerpc/mm/book3s32/mmu_context.c | 10 ++--- arch/powerpc/platforms/pasemi/dma_lib.c| 45 +- arch/powerpc/platforms/powernv/pci-sriov.c | 12 ++ 3 files

[PATCH 00/34] biops: add atomig find_bit() operations

2023-11-18 Thread Yury Norov
nel. They can be applied separately from each other on per-subsystems basis, or I can pull them in bitmap tree, as appropriate. [1] https://lore.kernel.org/lkml/634f5fdf-e236-42cf-be8d-48a581c21...@alu.unizg.hr/T/#m3e7341eb3571753f3acf8fe166f3fb5b2c12e615 Yury Norov (34): lib/find: add atom

[PATCH 01/34] lib/find: add atomic find_bit() primitives

2023-11-18 Thread Yury Norov
h'. All users of find_bit() API, where heavy concurrency is expected, are encouraged to switch to atomic find_and_bit() as appropriate. Signed-off-by: Yury Norov --- include/linux/find.h | 289 +++ lib/find_bit.c | 85 + 2 files chan

[PATCH 16/34] powerpc: use atomic find_bit() API where appropriate

2023-11-18 Thread Yury Norov
Fix opencoded find_and_{set,clear}_bit() by using dedicated functions. Signed-off-by: Yury Norov --- arch/powerpc/mm/book3s32/mmu_context.c | 10 ++--- arch/powerpc/platforms/pasemi/dma_lib.c| 45 +- arch/powerpc/platforms/powernv/pci-sriov.c | 12 ++ 3 files

[PATCH 2/2] powerpc: use node_has_cpus() instead of nr_cpus_node()

2023-02-21 Thread Yury Norov
Use node_has_cpus() as more efficient alternative to nr_cpus_node() where possible. Signed-off-by: Yury Norov --- arch/powerpc/platforms/cell/spu_priv1_mmio.c | 2 +- arch/powerpc/platforms/cell/spufs/sched.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

[PATCH 1/2] sched/topology: introduce node_has_cpus() macro

2023-02-21 Thread Yury Norov
that. Signed-off-by: Yury Norov --- include/linux/topology.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/topology.h b/include/linux/topology.h index fea32377f7c7..7e0d8f8f5a39 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -39,9

Re: [PATCH v4 1/1] x86: cpuinfo: Ensure inputs to cpumask_next are valid

2022-11-10 Thread Yury Norov
id cpu range"."), > will generate a warning when DEBUG_PER_CPU_MAPS is enabled each time > /proc/cpuinfo is read. Future-proof cpuinfo by checking its input to > cpumask_next() is valid. > > Signed-off-by: Andrew Jones > Cc: Yury Norov Reviewed-by: Yury Norov > ---

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Yury Norov
On Thu, Nov 03, 2022 at 05:49:06PM +0100, Borislav Petkov wrote: > On Thu, Nov 03, 2022 at 09:30:54AM -0700, yury.no...@gmail.com wrote:a > > Callers should pass sane arguments into internal functions if they > > expect sane output. > > What internal function? It's in a global header. > > > The A

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread yury . norov
On Thu, Nov 03, 2022 at 04:34:04PM +0100, Andrew Jones wrote: > On Thu, Nov 03, 2022 at 04:02:12PM +0100, Borislav Petkov wrote: > > On Thu, Nov 03, 2022 at 01:59:45PM +0100, Andrew Jones wrote: > > > The patch I'm proposing ensures cpumask_next()'s range, which is actually > > > [-1, nr_cpus_ids -

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-29 Thread Yury Norov
On Fri, Oct 28, 2022, 10:03 AM Borislav Petkov wrote: > On Fri, Oct 28, 2022 at 07:46:08AM -0700, Yury Norov wrote: > > I'll take it in bitmap-for-next this weekend. > > Why? Because it's related to bitmap API usage and has been revealed after some work in bitmaps.

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-28 Thread Yury Norov
On Fri, Oct 28, 2022 at 09:48:28AM +0200, Andrew Jones wrote: > Hi x86 maintainers, > > I realize 78e5a3399421 has now been reverted, so this fix is no longer > urgent. I don't believe it's wrong, though, so if it's still of interest, > then please consider this a friendly ping. > > Thanks, > dre

Re: [PATCH v3 0/2] Fix /proc/cpuinfo cpumask warning

2022-10-15 Thread Yury Norov
t; While the patches are being posted together in a series since they're > for two different architectures they don't necessarily need to go > through the same tree. Acked-by: Yury Norov

Re: [PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-08 Thread Yury Norov
ome treewide-cleanup > experience might share some wisdom about what the best timing usually > winds up being, I'm all ears. > > Please take a look! The number of lines touched is quite small, so this > should be reviewable, and as much as is possible has been pushed into >

[PATCH v2] powerpc/64: don't refer nr_cpu_ids in asm code when it's undefined

2022-09-20 Thread Yury Norov
of: [1] https://lore.kernel.org/lkml/20220905230820.3295223-4-yury.no...@gmail.com/T/#m96ffe122721893471fd3470d911a8f2fad6d03b3 Reported-by: Stephen Rothwell Signed-off-by: Yury Norov --- v2: move "lwz r7,0(r7)" under #else conditional. arch/powerpc/kernel/head_64.S | 4 1 file chang

Re: [PATCH] powerpc/64: don't refer nr_cpu_ids in asm code when it's undefined

2022-09-20 Thread Yury Norov
On Wed, Sep 21, 2022 at 08:20:06AM +1000, Stephen Rothwell wrote: > Hi Yury, > > On Tue, 20 Sep 2022 08:29:35 -0700 Yury Norov wrote: > > > > > diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S > > index cf2c08902c05..7cb97881635e 100644

[PATCH] powerpc/64: don't refer nr_cpu_ids in asm code when it's undefined

2022-09-20 Thread Yury Norov
of: [1] https://lore.kernel.org/lkml/20220905230820.3295223-4-yury.no...@gmail.com/T/#m96ffe122721893471fd3470d911a8f2fad6d03b3 Reported-by: Stephen Rothwell Signed-off-by: Yury Norov --- arch/powerpc/kernel/head_64.S | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/head_64.S

Re: [PATCH] gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file

2022-08-16 Thread Yury Norov
kefile.build:465: arch/powerpc/kernel] Fehler 2 > make: *** [Makefile:1855: arch/powerpc] Error 2 > > Change the DISABLE_LATENT_ENTROPY_PLUGIN flags to undefine > LATENT_ENTROPY_PLUGIN for files where the plugin is disabled. > > Cc: Yury Norov > Cc: Emese Revfy > Fixes: 36d4b36b6959 (&qu

[PATCH] lib: remove lib/nodemask.c

2022-08-11 Thread Yury Norov
Commit 36d4b36b69590 (lib/nodemask: inline next_node_in() and node_random()) removed the lib/nodemask.c file, but the remove didn't happen when the patch was applied. Reported-by: "Aneesh Kumar K.V" Signed-off-by: Yury Norov --- lib/nodemask.c | 23 --- 1 f

Re: [RESEND PATCH 2/2] lib/nodemask: inline next_node_in() and node_random()

2022-08-11 Thread Yury Norov
On Fri, Aug 12, 2022 at 10:46:57AM +0530, Aneesh Kumar K.V wrote: > Yury Norov writes: > > > The functions are pretty thin wrappers around find_bit engine, and > > keeping them in c-file prevents compiler from small_const_nbits() > > optimization, which must take pl

Re: [PATCH 1/2] powerpc: drop dependency on in archrandom.h

2022-07-26 Thread Yury Norov
On Tue, Jul 26, 2022 at 04:57:38PM +1000, Michael Ellerman wrote: > Yury Norov writes: > > On Mon, Jul 25, 2022 at 09:28:12AM +0200, Andy Shevchenko wrote: > >> On Sun, Jul 24, 2022 at 12:19 AM Yury Norov wrote: > >> > > >> > archrandom.h includes to

Re: [PATCH 1/2] powerpc: drop dependency on in archrandom.h

2022-07-25 Thread Yury Norov
On Mon, Jul 25, 2022 at 11:39:39PM +0200, Andy Shevchenko wrote: > On Mon, Jul 25, 2022 at 6:19 PM Yury Norov wrote: > > On Mon, Jul 25, 2022 at 09:28:12AM +0200, Andy Shevchenko wrote: > > > On Sun, Jul 24, 2022 at 12:19 AM Yury Norov wrote: > > ... > > > &g

Re: [PATCH 1/2] powerpc: drop dependency on in archrandom.h

2022-07-25 Thread Yury Norov
On Mon, Jul 25, 2022 at 10:22:13PM +1000, Michael Ellerman wrote: > Michael Ellerman writes: > > Yury Norov writes: > >> archrandom.h includes to refer ppc_md. This causes > >> circular header dependency, if generic nodemask.h includes random.h: > >> >

Re: [PATCH 1/2] powerpc: drop dependency on in archrandom.h

2022-07-25 Thread Yury Norov
On Mon, Jul 25, 2022 at 09:28:12AM +0200, Andy Shevchenko wrote: > On Sun, Jul 24, 2022 at 12:19 AM Yury Norov wrote: > > > > archrandom.h includes to refer ppc_md. This causes > > circular header dependency, if generic nodemask.h includes random.h: > > > > In

[PATCH 0/2] lib/nodemask: inline wrappers around bitmap

2022-07-23 Thread Yury Norov
On top of g...@github.com:/norov/linux.git bitmap-for-next. There are just 2 functions in nodemask.c, both are thin wrappers around bitmap API. 1st patch of this series drops dependency on in archrandom.h lib/nodemask: inline next_node_in() and node_random() MAINTAINERS

[PATCH 1/2] powerpc: drop dependency on in archrandom.h

2022-07-23 Thread Yury Norov
, from arch/powerpc/kernel/asm-offsets.c:12: include/linux/sched.h:1203:9: error: unknown type name 'nodemask_t' 1203 | nodemask_t mems_allowed; | ^~ Fix it by removing dependency from archrandom.h Signed-off-by: Yury Norov

[RESEND PATCH 2/2] lib/nodemask: inline next_node_in() and node_random()

2022-07-23 Thread Yury Norov
p the kernel size: add/remove: 1/2 grow/shrink: 9/5 up/down: 968/-88 (880) CC: Andy Shevchenko CC: Rasmus Villemoes Signed-off-by: Yury Norov --- MAINTAINERS | 1 - include/linux/nodemask.h | 27 ++- lib/Makefile | 2 +- lib/nodem

[PATCH 43/49] soc/qman: replace cpumask_weight with cpumask_weight_lt

2022-02-10 Thread Yury Norov
qman_test_stash() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_lt because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is (or can't be) met. Signed-off-by: Yury

[PATCH 38/49] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate

2022-02-10 Thread Yury Norov
PowerPC code uses cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is (or can't be) met. Signed-off-by: Yury

[PATCH 46/54] soc: replace cpumask_weight with cpumask_weight_lt

2022-01-23 Thread Yury Norov
qman_test_stash() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_lt because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- drivers/soc

[PATCH 39/54] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate

2022-01-23 Thread Yury Norov
PowerPC code uses cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- arch

Re: [PATCH 01/17] all: don't use bitmap_weight() where possible

2021-12-18 Thread Yury Norov
On Sat, Dec 18, 2021 at 2:16 PM Michał Mirosław wrote: > > On Sat, Dec 18, 2021 at 01:19:57PM -0800, Yury Norov wrote: > > Don't call bitmap_weight() if the following code can get by > > without it. > > > > Signed-off-by: Yury Norov > > --- > >

[PATCH 17/17] MAINTAINERS: add cpumask and nodemask files to BITMAP_API

2021-12-18 Thread Yury Norov
cpumask and nodemask APIs are thin wrappers around basic bitmap API, and corresponding files are not formally maintained. This patch adds them to BITMAP_API section, so that bitmap folks would have closer look at it. Signed-off-by: Yury Norov --- MAINTAINERS | 4 1 file changed, 4

[PATCH 16/17] tools/bitmap: sync bitmap_weight

2021-12-18 Thread Yury Norov
Pull bitmap_weight_{cmp,eq,gt,ge,lt,le} from mother kernel and use where applicable. Signed-off-by: Yury Norov --- tools/include/linux/bitmap.h | 44 tools/lib/bitmap.c | 20 tools/perf/util/pmu.c| 2 +- 3 files changed

[PATCH 15/17] kernel/cpu: add num_active_cpu counter

2021-12-18 Thread Yury Norov
: Yury Norov --- include/linux/cpumask.h | 26 +++--- kernel/cpu.c| 15 +++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index c2a9d15e2cbd..0add872898f8 100644 --- a/include/linux

[PATCH 14/17] kernel/cpu: add num_present_cpu counter

2021-12-18 Thread Yury Norov
-by: Yury Norov --- include/linux/cpumask.h | 25 +++-- kernel/cpu.c| 16 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 0be2504d8e4c..c2a9d15e2cbd 100644 --- a/include/linux

[PATCH 13/17] kernel/cpu: add num_possible_cpus counter

2021-12-18 Thread Yury Norov
Piggin Signed-off-by: Yury Norov --- include/linux/cpumask.h | 30 -- kernel/cpu.c| 22 ++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 1906e3225737..0be2504d8e4c

[PATCH 12/17] kernel/cpu.c: fix init_cpu_online

2021-12-18 Thread Yury Norov
cpu_online_mask has an associate counter of online cpus, which should be initialized in init_cpu_online() Fixes: 0c09ab96fc82010 (cpu/hotplug: Cache number of online CPUs) Signed-off-by: Yury Norov --- kernel/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/cpu.c b/kernel/cpu.c

[PATCH 11/17] lib/nodemask: add num_node_state_eq()

2021-12-18 Thread Yury Norov
-by: Yury Norov --- include/linux/nodemask.h | 5 + mm/page_alloc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 197598e075e9..c5014dbf3cce 100644 --- a/include/linux/nodemask.h +++ b/include/linux

[PATCH 10/17] lib/nodemask: add nodemask_weight_{eq,gt,ge,lt,le}

2021-12-18 Thread Yury Norov
Kernel code calls nodes_weight() to compare the weight of nodemask with a given number. We can do it more efficiently with nodes_weight_{eq, ...} because conditional nodes_weight may stop traversing the nodemask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- drivers/acpi

[PATCH 09/17] lib/cpumask: add cpumask_weight_{eq,gt,ge,lt,le}

2021-12-18 Thread Yury Norov
Kernel code calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- arch/ia64

[PATCH 08/17] all: replace bitmap_weight with bitmap_weight_{eq, gt, ge, lt, le} where appropriate

2021-12-18 Thread Yury Norov
conditional versions where possible, except for small bitmaps which size is not configurable and known at constant time. In that case conditional version of bitmap_weight would not benefit due to small_const_nbits() optimization; but readability may suffer. Signed-off-by: Yury Norov --- arch/x86/kernel

[PATCH 07/17] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions

2021-12-18 Thread Yury Norov
ier. This patch adds new bitmap_weight_cmp() as suggested by Michał Mirosław and a family of eq, gt, ge, lt and le wrappers to allow this optimization. The following patches apply new functions where appropriate. Suggested-by: "Michał Mirosław" (for bitmap_weight_cmp) Signed-off-b

[PATCH 06/17] all: replace nodes_weight with nodes_empty where appropriate

2021-12-18 Thread Yury Norov
Kernel code calls nodes_weight() to check if any bit of a given nodemask is set. We can do it more efficiently with nodes_empty() because nodes_empty() stops traversing the nodemask as soon as it finds first set bit, while nodes_weight() counts all bits unconditionally. Signed-off-by: Yury Norov

[PATCH 05/17] all: replace cpumask_weight with cpumask_empty where appropriate

2021-12-18 Thread Yury Norov
. Signed-off-by: Yury Norov --- arch/alpha/kernel/process.c| 2 +- arch/ia64/kernel/setup.c | 2 +- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 14 +++--- arch/x86/mm/mmio-mod.c | 2 +- arch/x86/platform/uv/uv_nmi.c | 2 +- drivers/cpufreq/qcom

[PATCH 04/17] all: replace bitmap_weight with bitmap_empty where appropriate

2021-12-18 Thread Yury Norov
ff-by: Yury Norov --- arch/nds32/kernel/perf_event_cpu.c | 2 +- arch/x86/kvm/hyperv.c | 8 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c| 2 +- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c| 4 ++-- driver

[PATCH 03/17] fix open-coded for_each_set_bit()

2021-12-18 Thread Yury Norov
Mellanox driver has an open-coded for_each_set_bit(). Fix it. Signed-off-by: Yury Norov --- drivers/net/ethernet/mellanox/mlx4/cmd.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet

[PATCH 02/17] drivers: rename num_*_cpus variables

2021-12-18 Thread Yury Norov
Some drivers declare num_active_cpus and num_present_cpus, despite that kernel has macros with corresponding names in linux/cpumask.h, and the drivers include cpumask.h The following patches switch num_*_cpus() to real functions, which causes build failures for the drivers. Signed-off-by: Yury

[PATCH v2 00/17] lib/bitmap: optimize bitmap_weight() usage

2021-12-18 Thread Yury Norov
ixes around bit counting that spotted my eyes. Yury Norov (17): all: don't use bitmap_weight() where possible drivers: rename num_*_cpus variables fix open-coded for_each_set_bit() all: replace bitmap_weight with bitmap_empty where appropriate all: replace cpumask_weight with cpu

[PATCH 01/17] all: don't use bitmap_weight() where possible

2021-12-18 Thread Yury Norov
Don't call bitmap_weight() if the following code can get by without it. Signed-off-by: Yury Norov --- drivers/net/dsa/b53/b53_common.c | 6 +- drivers/net/ethernet/broadcom/bcmsysport.c | 6 +- drivers/thermal/intel/intel_powerclamp.c | 9 +++-- 3 files chang

Re: [PATCH 2/9] lib/bitmap: implement bitmap_{empty, full} with bitmap_weight_eq()

2021-12-16 Thread Yury Norov
On Wed, Dec 15, 2021 at 12:41 AM David Laight wrote: > > From: Yury Norov > > Sent: 14 December 2021 19:43 > ... > > > > I think that for long bitmaps the most time consuming operation is moving > > data to L1, and for short bitmaps the difference between ap

Re: [PATCH 2/9] lib/bitmap: implement bitmap_{empty, full} with bitmap_weight_eq()

2021-12-14 Thread Yury Norov
On Sun, Nov 28, 2021 at 10:10 AM Michał Mirosław wrote: > > On Sat, Nov 27, 2021 at 07:56:57PM -0800, Yury Norov wrote: > > Now as we have bitmap_weight_eq(), switch bitmap_full() and > > bitmap_empty() to using it. > > > > Signed-off-by: Yury Norov > >

Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage

2021-12-01 Thread Yury Norov
On Mon, Nov 29, 2021 at 04:34:07PM +, Michał Mirosław wrote: > Dnia 29 listopada 2021 06:38:39 UTC, Yury Norov > napisał/a: > >On Sun, Nov 28, 2021 at 07:03:41PM +0100, mirq-t...@rere.qmqm.pl wrote: > >> On Sat, Nov 27, 2021 at 07:56:55PM -0800, Yury Norov wrote: > &

Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage

2021-11-28 Thread Yury Norov
On Sun, Nov 28, 2021 at 07:03:41PM +0100, mirq-t...@rere.qmqm.pl wrote: > On Sat, Nov 27, 2021 at 07:56:55PM -0800, Yury Norov wrote: > > In many cases people use bitmap_weight()-based functions like this: > > > > if (num_present_cpus() > 1) > > do_

Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage

2021-11-28 Thread Yury Norov
On Sun, Nov 28, 2021 at 09:08:41PM +1000, Nicholas Piggin wrote: > Excerpts from Yury Norov's message of November 28, 2021 1:56 pm: > > In many cases people use bitmap_weight()-based functions like this: > > > > if (num_present_cpus() > 1) > > do_something(); > > > > This may take

Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}

2021-11-28 Thread Yury Norov
On Sun, Nov 28, 2021 at 12:54:00PM -0500, Dennis Zhou wrote: > Hello, > > On Sun, Nov 28, 2021 at 09:43:20AM -0800, Yury Norov wrote: > > On Sun, Nov 28, 2021 at 09:07:52AM -0800, Joe Perches wrote: > > > On Sat, 2021-11-27 at 19:57 -0800, Yury Norov wrote: > >

Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}

2021-11-28 Thread Yury Norov
On Sun, Nov 28, 2021 at 09:07:52AM -0800, Joe Perches wrote: > On Sat, 2021-11-27 at 19:57 -0800, Yury Norov wrote: > > Add num_{possible,present,active}_cpus_{eq,gt,le} and replace num_*_cpus() > > with one of new functions where appropriate. This allows num_*_cpus_*() > &

Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}

2021-11-27 Thread Yury Norov
(restore CC list) On Sun, Nov 28, 2021 at 05:56:51AM +0100, Michał Mirosław wrote: > On Sat, Nov 27, 2021 at 07:57:02PM -0800, Yury Norov wrote: > > Add num_{possible,present,active}_cpus_{eq,gt,le} and replace num_*_cpus() > > with one of new functions where appropriate. This all

Re: [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} with bitmap_weight_eq()

2021-11-27 Thread Yury Norov
On Sun, Nov 28, 2021 at 05:37:19AM +0100, Michał Mirosław wrote: > On Sat, Nov 27, 2021 at 07:56:57PM -0800, Yury Norov wrote: > > Now as we have bitmap_weight_eq(), switch bitmap_full() and > > bitmap_empty() to using it. > [...] > > -static inline bool bitmap_empty(

[PATCH 9/9] MAINTAINERS: add cpumask and nodemask files to BITMAP_API

2021-11-27 Thread Yury Norov
cpumask and nodemask APIs are thin wrappers around basic bitmap API, and corresponding files are not formally maintained. This patch adds them to BITMAP_API section, so that bitmap folks would have closer look at it. Signed-off-by: Yury Norov --- MAINTAINERS | 4 1 file changed, 4

[PATCH 8/9] lib/nodemask: add num_node_state_eq()

2021-11-27 Thread Yury Norov
Add num_node_state_eq() and replace num_node_state() with it in page_alloc_init(). Signed-off-by: Yury Norov --- include/linux/nodemask.h | 5 + mm/page_alloc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h

[PATCH 7/9] lib/cpumask: add num_{possible, present, active}_cpus_{eq, gt, le}

2021-11-27 Thread Yury Norov
Add num_{possible,present,active}_cpus_{eq,gt,le} and replace num_*_cpus() with one of new functions where appropriate. This allows num_*_cpus_*() to return earlier depending on the condition. Signed-off-by: Yury Norov --- arch/arc/kernel/smp.c | 2 +- arch/arm/kernel

[PATCH 6/9] lib/nodemask: add nodemask_weight_{eq,gt,le}

2021-11-27 Thread Yury Norov
Add nodemask_weight_{eq,gt,le} and replace nodemask_weight() where appropriate. This allows nodemask_weight_*() to return earlier depending on the condition. Signed-off-by: Yury Norov --- arch/x86/mm/amdtopology.c| 2 +- arch/x86/mm/numa_emulation.c | 4 ++-- drivers/acpi/numa/srat.c

[PATCH 5/9] lib/cpumask: add cpumask_weight_{eq,gt,le}

2021-11-27 Thread Yury Norov
Add cpumask_weight_{eq,gt,le} and replace cpumask_weight() with one of cpumask_weight_{empty,eq,gt,le} where appropriate. This allows cpumask_weight_*() to return earlier depending on the condition. Signed-off-by: Yury Norov --- arch/alpha/kernel/process.c | 2 +- arch/ia64/kernel

[PATCH 4/9] tools: sync bitmap_weight() usage with the kernel

2021-11-27 Thread Yury Norov
replace bitmap_weight() where appropriate. Signed-off-by: Yury Norov --- tools/include/linux/bitmap.h | 42 +++-- tools/lib/bitmap.c | 60 tools/perf/builtin-c2c.c | 4 +-- tools/perf/util/pmu.c| 2 +- 4 files changed, 96

[PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty, full, eq, gt, le}

2021-11-27 Thread Yury Norov
appropriate. In some places driver code has been optimized further, where it's trivial. Signed-off-by: Yury Norov --- arch/nds32/kernel/perf_event_cpu.c | 4 +--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 ++-- arch/x86/kvm/hyperv.c

[PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage

2021-11-27 Thread Yury Norov
ith corresponding wrappers in cpumask and nodemask. Yury Norov (9): lib/bitmap: add bitmap_weight_{eq,gt,le} lib/bitmap: implement bitmap_{empty,full} with bitmap_weight_eq() all: replace bitmap_weigth() with bitmap_{empty,full,eq,gt,le} tools: sync bitmap_weight() usage with the kernel

[PATCH 1/9] lib/bitmap: add bitmap_weight_{eq,gt,le}

2021-11-27 Thread Yury Norov
his patch adds new bitmap_weight_{eq,gt,le} functions to allow this optimization, and the following patches apply them where appropriate. Signed-off-by: Yury Norov --- include/linux/bitmap.h | 33 ++ lib/bitmap.c | 63 ++ 2 fi

[PATCH 2/9] lib/bitmap: implement bitmap_{empty, full} with bitmap_weight_eq()

2021-11-27 Thread Yury Norov
Now as we have bitmap_weight_eq(), switch bitmap_full() and bitmap_empty() to using it. Signed-off-by: Yury Norov --- include/linux/bitmap.h | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index

Re: [PATCH] powerpc: fix AKEBONO build failures

2021-01-20 Thread Yury Norov
On Wed, Jan 20, 2021 at 10:10 PM Randy Dunlap wrote: > > On 1/20/21 1:29 PM, Yury Norov wrote: > > Hi all, > > > > I found the power pc build broken on today's > > linux-next (647060f3b592). > > Darn, I was building linux-5.11-rc4. > > I'll try

linux-next: build failure on power pc

2021-01-20 Thread Yury Norov
Hi all, I found the power pc build broken on today's linux-next (647060f3b592). My compiler is: yury:linux$ powerpc-linux-gnu-gcc --version powerpc-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copyi

Re: [PATCH] powerpc: restore current_thread_info()

2019-05-07 Thread Yury Norov
On Tue, May 07, 2019 at 11:58:56PM +0100, Al Viro wrote: > On Tue, May 07, 2019 at 03:51:21PM -0700, Yury Norov wrote: > > Commit ed1cd6deb013 ("powerpc: Activate CONFIG_THREAD_INFO_IN_TASK") > > removes the function current_thread_info(). It's wrong because the &g

[PATCH] powerpc: restore current_thread_info()

2019-05-07 Thread Yury Norov
ov/linux/commit/b269e51eee66ffec3008a3effb12363b91754e49 it causes build break. This patch restores current_thread_info(). Signed-off-by: Yury Norov --- arch/powerpc/include/asm/thread_info.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powe

  1   2   >