public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] lib/group_cpus: rework grp_spread_init_one() and make it O(1)
@ 2023-12-07 20:38 Yury Norov
  2023-12-07 20:38 ` [PATCH v2 1/6] cpumask: introduce for_each_cpu_and_from() Yury Norov
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Yury Norov @ 2023-12-07 20:38 UTC (permalink / raw)
  To: Andrew Morton, Thomas Gleixner, linux-kernel
  Cc: Yury Norov, Ming Lei, Andy Shevchenko, Rasmus Villemoes

grp_spread_init_one() implementation is sub-optimal because it
traverses bitmaps from the beginning, instead of picking from the
previous iteration.

Fix it and use find_bit API where appropriate. While here, optimize
cpumasks allocation and drop unneeded cpumask_empty() call.

---
v1: https://lore.kernel.org/all/ZW5MI3rKQueLM0Bz@yury-ThinkPad/T/
v2: add few more optimizations (patches 5-6)

Yury Norov (6):
  cpumask: introduce for_each_cpu_and_from()
  lib/group_cpus: relax atomicity requirement in grp_spread_init_one()
  lib/group_cpus: optimize inner loop in grp_spread_init_one()
  lib/group_cpus: optimize outer loop in grp_spread_init_one()
  lib/cgroup_cpus.c: don't zero cpumasks in group_cpus_evenly() on
    allocation
  lib/group_cpus.c: drop unneeded cpumask_empty() call in
    __group_cpus_evenly()

 include/linux/cpumask.h | 11 ++++++++++
 include/linux/find.h    |  3 +++
 lib/group_cpus.c        | 47 +++++++++++++++++++----------------------
 3 files changed, 36 insertions(+), 25 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2023-12-08  3:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-07 20:38 [PATCH v2 0/6] lib/group_cpus: rework grp_spread_init_one() and make it O(1) Yury Norov
2023-12-07 20:38 ` [PATCH v2 1/6] cpumask: introduce for_each_cpu_and_from() Yury Norov
2023-12-07 21:41   ` Andrew Morton
2023-12-07 22:16     ` Yury Norov
2023-12-07 20:38 ` [PATCH v2 2/6] lib/group_cpus: relax atomicity requirement in grp_spread_init_one() Yury Norov
2023-12-08  1:31   ` Ming Lei
2023-12-08  2:49     ` Yury Norov
2023-12-08  3:28       ` Ming Lei
2023-12-07 20:38 ` [PATCH v2 3/6] lib/group_cpus: optimize inner loop " Yury Norov
2023-12-07 21:45   ` Andrew Morton
2023-12-07 22:07     ` Yury Norov
2023-12-07 20:38 ` [PATCH v2 4/6] lib/group_cpus: optimize outer " Yury Norov
2023-12-07 20:38 ` [PATCH 5/6] lib/cgroup_cpus.c: don't zero cpumasks in group_cpus_evenly() on allocation Yury Norov
2023-12-07 20:39 ` [PATCH 6/6] lib/group_cpus.c: drop unneeded cpumask_empty() call in __group_cpus_evenly() Yury Norov
2023-12-07 21:46 ` [PATCH v2 0/6] lib/group_cpus: rework grp_spread_init_one() and make it O(1) Andrew Morton
2023-12-07 22:19   ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox