linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] Introduce DEBUG_BITMAP config option and bitmap_check_params()
@ 2022-07-18 19:28 Yury Norov
  2022-07-18 19:28 ` [PATCH 01/16] lib/bitmap: add bitmap_check_params() Yury Norov
                   ` (15 more replies)
  0 siblings, 16 replies; 40+ messages in thread
From: Yury Norov @ 2022-07-18 19:28 UTC (permalink / raw)
  To: linux-kernel, Alexander Lobakin, Alexei Starovoitov,
	Alexey Klimov, Andrew Morton, Andrii Nakryiko, Andy Shevchenko,
	Ben Segall, Christoph Lameter, Dan Williams, Daniel Borkmann,
	Daniel Bristot de Oliveira, Dennis Zhou, Dietmar Eggemann,
	Eric Dumazet, Frederic Weisbecker, Guenter Roeck, Ingo Molnar,
	Isabella Basso, John Fastabend, Josh Poimboeuf, Juergen Gross,
	Juri Lelli, KP Singh, Kees Cook, Martin KaFai Lau, Mel Gorman,
	Miroslav Benes, Nathan Chancellor, Paul E . McKenney,
	Peter Zijlstra, Randy Dunlap, Rasmus Villemoes,
	Sebastian Andrzej Siewior, Song Liu, Steven Rostedt, Tejun Heo,
	Thomas Gleixner, Valentin Schneider, Vincent Guittot,
	Vlastimil Babka, Yonghong Song, Yury Norov, linux-mm, netdev, bpf

Bitmap functions are often a part of hot paths, and we can't put argument
sanity checks inside them. Sometimes wrong parameters combination cause
bug reports that are pretty hard to investigate:
https://lore.kernel.org/linux-mm/YsbpTNmDaam8pl+f@xsang-OptiPlex-9020/

And sometimes we can optimize caller code. For example, to avoid copying
of bitmap if source and destination are the same.

It's quite tricky to detect such places unless we've covered all bitmap
API calls with the parameters checker.

This series:
 - introduces bitmap_check_params() with a couple of common-used wrappers;
 - clears all bitmap warnings found for x86_64, arm64 and powerpc64 in
   boot test.

Yury Norov (16):
  lib/bitmap: add bitmap_check_params()
  lib/bitmap: don't call bitmap_set() with len == 0
  lib/test_bitmap: don't test bitmap_set if nbits == 0
  lib/test_bitmap: test test_bitmap_arr{32,64} starting from nbits == 1
  lib/test_bitmap: disable compile-time test if DEBUG_BITMAP() is
    enabled
  lib/test_bitmap: delete meaningless test for bitmap_cut
  smp: optimize smp_call_function_many_cond()
  smp: optimize smp_call_function_many_cond() for more
  irq: don't copy cpu affinity mask if source is equal to destination
  sched: optimize __set_cpus_allowed_ptr_locked()
  time: optimize tick_check_preferred()
  time: optimize tick_check_percpu()
  time: optimize tick_setup_device()
  mm/percpu: optimize pcpu_alloc_area()
  sched/topology: optimize topology_span_sane()
  lib: create CONFIG_DEBUG_BITMAP parameter

 include/linux/bitmap.h    |  95 +++++++++++++++++++++++++++
 kernel/irq/manage.c       |   3 +-
 kernel/sched/core.c       |   3 +-
 kernel/sched/topology.c   |  10 ++-
 kernel/smp.c              |  35 ++++++++--
 kernel/time/tick-common.c |  18 ++++--
 lib/Kconfig.debug         |   7 ++
 lib/bitmap.c              | 132 ++++++++++++++++++++++++++++++++++----
 lib/test_bitmap.c         |  12 ++--
 mm/percpu.c               |   3 +-
 10 files changed, 281 insertions(+), 37 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2022-08-09 12:37 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-18 19:28 [PATCH 00/16] Introduce DEBUG_BITMAP config option and bitmap_check_params() Yury Norov
2022-07-18 19:28 ` [PATCH 01/16] lib/bitmap: add bitmap_check_params() Yury Norov
2022-07-18 21:01   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 02/16] lib/bitmap: don't call bitmap_set() with len == 0 Yury Norov
2022-07-18 21:06   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 03/16] lib/test_bitmap: don't test bitmap_set if nbits " Yury Norov
2022-07-18 21:08   ` Andy Shevchenko
2022-08-09 12:37   ` Rasmus Villemoes
2022-07-18 19:28 ` [PATCH 04/16] lib/test_bitmap: test test_bitmap_arr{32,64} starting from nbits == 1 Yury Norov
2022-07-18 21:09   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 05/16] lib/test_bitmap: disable compile-time test if DEBUG_BITMAP() is enabled Yury Norov
2022-07-18 21:10   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 06/16] lib/test_bitmap: delete meaningless test for bitmap_cut Yury Norov
2022-07-18 21:11   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 07/16] smp: optimize smp_call_function_many_cond() Yury Norov
2022-07-18 21:26   ` Peter Zijlstra
2022-07-18 21:36   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 08/16] smp: optimize smp_call_function_many_cond() for more Yury Norov
2022-07-18 21:29   ` Peter Zijlstra
2022-07-20 17:06     ` Yury Norov
2022-07-18 21:37   ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 09/16] irq: don't copy cpu affinity mask if source is equal to destination Yury Norov
2022-07-18 21:30   ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 10/16] sched: optimize __set_cpus_allowed_ptr_locked() Yury Norov
2022-07-18 21:34   ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 11/16] time: optimize tick_check_preferred() Yury Norov
2022-08-06  8:30   ` Thomas Gleixner
2022-08-08 11:42     ` Thomas Gleixner
2022-08-08 16:38       ` Yury Norov
2022-08-09 12:29         ` Rasmus Villemoes
2022-07-18 19:28 ` [PATCH 12/16] time: optimize tick_check_percpu() Yury Norov
2022-07-18 19:28 ` [PATCH 13/16] time: optimize tick_setup_device() Yury Norov
2022-07-18 21:35   ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 14/16] mm/percpu: optimize pcpu_alloc_area() Yury Norov
2022-07-19  4:25   ` Dennis Zhou
2022-07-18 19:28 ` [PATCH 15/16] sched/topology: optimize topology_span_sane() Yury Norov
2022-07-18 21:37   ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 16/16] lib: create CONFIG_DEBUG_BITMAP parameter Yury Norov
2022-07-18 21:39   ` Andy Shevchenko
2022-07-20 16:49     ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).