All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/3] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes
@ 2023-04-14 16:30 Thomas Gleixner
  2023-04-14 16:30 ` [patch 1/3] lib/percpu_counter: Fix CPU hotplug handling Thomas Gleixner
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Thomas Gleixner @ 2023-04-14 16:30 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Valentin Schneider, Dennis Zhou, Tejun Heo,
	Christoph Lameter, Dave Chinner, Yury Norov, Andy Shevchenko,
	Rasmus Villemoes, Ye Bin, linux-mm

Hi!

The cpu_dying_mask is not only undocumented but also to some extent a
misnomer. It's purpose is to capture the last direction of a cpu_up() or
cpu_down() operation taking eventual rollback operations into account.

cpu_dying mask is not really useful for general consumption. The
cpu_dying_mask bits are sticky even after cpu_up() or cpu_down() completes.

A recent fix to plug a race in the per CPU counter code picked
cpu_dying_mask to cure it. Unfortunately this does not work as the author
probably expected and the behaviour of cpu_dying_mask is not easy to change
without breaking the only other and initial user, the scheduler.

This series addresses this by:

   1) Reworking the per CPU counter hotplug mechanism so the race is fully
      plugged without using cpu_dying_mask

   2) Replacing the cpu_dying_mask logic with hotplug core internal state
      which is exposed to the scheduler with a properly documented
      function.

The series is also available from git:

  git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git smp/dying_mask

Thanks

	tglx
---
 include/linux/cpuhotplug.h |    2 -
 include/linux/cpumask.h    |   21 ----------------
 kernel/cpu.c               |   45 +++++++++++++++++++++++++++++------
 kernel/sched/core.c        |    4 +--
 kernel/smpboot.h           |    2 +
 lib/percpu_counter.c       |   57 +++++++++++++++++++--------------------------
 6 files changed, 67 insertions(+), 64 deletions(-)


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/3 v2] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes
@ 2024-01-12 23:36 Dennis Zhou
  2024-01-12 23:36 ` [PATCH 1/3] lib/percpu_counter: Fix CPU hotplug handling Dennis Zhou
  0 siblings, 1 reply; 10+ messages in thread
From: Dennis Zhou @ 2024-01-12 23:36 UTC (permalink / raw)
  To: Tejun Heo, Christoph Lameter, Thomas Gleixner
  Cc: Peter Zijlstra, Valentin Schneider, Dave Chinner, Yury Norov,
	Andy Shevchenko, Rasmus Villemoes, Ye Bin, linux-mm, linux-kernel,
	Dennis Zhou

Hi everyone,

This is a respin of Thomas' series [1] against v6.7-rc4. Largely it's
the same minus a slight change in percpu_counter.c for batch
percpu_counters and updating __percpu_counter_limited_add().

I don't think we reached an alternative resolution here so I can queue
this up and give it some soak time in for-next.

[1] https://lore.kernel.org/lkml/20230414162755.281993820@linutronix.de/

Thanks,
Dennis

Dennis Zhou (2):
  lib/percpu_counter: Fix CPU hotplug handling
  cpu/hotplug: Get rid of cpu_dying_mask

Thomas Gleixner (1):
  cpu/hotplug: Remove export of cpu_active_mask and cpu_dying_mask

 include/linux/cpuhotplug.h |  2 +-
 include/linux/cpumask.h    | 21 ------------
 kernel/cpu.c               | 45 +++++++++++++++++++++-----
 kernel/sched/core.c        |  4 +--
 kernel/smpboot.h           |  2 ++
 lib/percpu_counter.c       | 65 ++++++++++++++++----------------------
 6 files changed, 70 insertions(+), 69 deletions(-)

-- 
2.39.1



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

end of thread, other threads:[~2024-01-12 23:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-14 16:30 [patch 0/3] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes Thomas Gleixner
2023-04-14 16:30 ` [patch 1/3] lib/percpu_counter: Fix CPU hotplug handling Thomas Gleixner
2023-04-15  5:20   ` Dennis Zhou
2023-04-17  2:09   ` Dave Chinner
2023-04-17  8:09     ` Thomas Gleixner
2023-04-14 16:30 ` [patch 2/3] cpu/hotplug: Remove export of cpu_active_mask and cpu_dying_mask Thomas Gleixner
2023-04-14 16:30 ` [patch 3/3] cpu/hotplug: Get rid of cpu_dying_mask Thomas Gleixner
2023-05-03 11:50 ` [patch 0/3] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes Valentin Schneider
2023-12-30 22:39 ` Dennis Zhou
  -- strict thread matches above, loose matches on Subject: below --
2024-01-12 23:36 [PATCH 0/3 v2] " Dennis Zhou
2024-01-12 23:36 ` [PATCH 1/3] lib/percpu_counter: Fix CPU hotplug handling Dennis Zhou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.