The patch titled Subject: percpu: export per_cpu_sum() has been added to the -mm tree. Its filename is percpu-export-per_cpu_sum.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/percpu-export-per_cpu_sum.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/percpu-export-per_cpu_sum.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Xunlei Pang <xlpang@xxxxxxxxxxxxxxxxx> Subject: percpu: export per_cpu_sum() per_cpu_sum() is useful, and deserves to be exported. Link: https://lkml.kernel.org/r/1615303512-35058-4-git-send-email-xlpang@xxxxxxxxxxxxxxxxx Signed-off-by: Xunlei Pang <xlpang@xxxxxxxxxxxxxxxxx> Tested-by: James Wang <jnwang@xxxxxxxxxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Shu Ming <sming56@xxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Wen Yang <wenyang@xxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/percpu-defs.h | 10 ++++++++++ kernel/locking/percpu-rwsem.c | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) --- a/include/linux/percpu-defs.h~percpu-export-per_cpu_sum +++ a/include/linux/percpu-defs.h @@ -220,6 +220,16 @@ do { \ (void)__vpp_verify; \ } while (0) +#define per_cpu_sum(var) \ +({ \ + typeof(var) __sum = 0; \ + int cpu; \ + compiletime_assert_atomic_type(__sum); \ + for_each_possible_cpu(cpu) \ + __sum += per_cpu(var, cpu); \ + __sum; \ +}) + #ifdef CONFIG_SMP /* --- a/kernel/locking/percpu-rwsem.c~percpu-export-per_cpu_sum +++ a/kernel/locking/percpu-rwsem.c @@ -178,16 +178,6 @@ bool __percpu_down_read(struct percpu_rw } EXPORT_SYMBOL_GPL(__percpu_down_read); -#define per_cpu_sum(var) \ -({ \ - typeof(var) __sum = 0; \ - int cpu; \ - compiletime_assert_atomic_type(__sum); \ - for_each_possible_cpu(cpu) \ - __sum += per_cpu(var, cpu); \ - __sum; \ -}) - /* * Return true if the modular sum of the sem->read_count per-CPU variable is * zero. If this sum is zero, then it is stable due to the fact that if any _ Patches currently in -mm which might be from xlpang@xxxxxxxxxxxxxxxxx are mm-slub-introduce-two-counters-for-partial-objects.patch mm-slub-get-rid-of-count_partial.patch percpu-export-per_cpu_sum.patch mm-slub-use-percpu-partial-free-counter.patch