Skip to content

lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes

Thomas Gleixner linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib/percpu_counter: Fix CPU hotplug handlinginclude/linux/cpuhotplug.h lib/percpu_counter.c+26 -333 replies
2/3cpu/hotplug: Remove export of cpu_active_mask and cpu_dying_maskkernel/cpu.c+0 -20 replies
3/3cpu/hotplug: Get rid of cpu_dying_maskinclude/linux/cpumask.h kernel/cpu.c kernel/sched/core.c +1 more+41 -290 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDennis ZhouValentin Schneider
SeriesR-b
1/3A-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 0/3] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes

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(-)