Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/64s: Use dec_mm_active_cpus helper

Avoid open-coded atomic_dec on mm->context.active_cpus and use the
function made for it. Add CONFIG_DEBUG_VM underflow checking on the
counter.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230524060821.148015-3-npiggin@gmail.com

authored by

Nicholas Piggin and committed by
Michael Ellerman
f74b2a6c c3c2e937

+3 -2
+1 -1
arch/powerpc/include/asm/book3s/64/mmu.h
··· 261 261 #define arch_clear_mm_cpumask_cpu(cpu, mm) \ 262 262 do { \ 263 263 if (cpumask_test_cpu(cpu, mm_cpumask(mm))) { \ 264 - atomic_dec(&(mm)->context.active_cpus); \ 264 + dec_mm_active_cpus(mm); \ 265 265 cpumask_clear_cpu(cpu, mm_cpumask(mm)); \ 266 266 } \ 267 267 } while (0)
+1
arch/powerpc/include/asm/mmu_context.h
··· 127 127 128 128 static inline void dec_mm_active_cpus(struct mm_struct *mm) 129 129 { 130 + VM_WARN_ON_ONCE(atomic_read(&mm->context.active_cpus) <= 0); 130 131 atomic_dec(&mm->context.active_cpus); 131 132 } 132 133
+1 -1
arch/powerpc/mm/book3s64/radix_tlb.c
··· 820 820 * that's what the caller expects. 821 821 */ 822 822 if (cpumask_test_cpu(cpu, mm_cpumask(mm))) { 823 - atomic_dec(&mm->context.active_cpus); 823 + dec_mm_active_cpus(mm); 824 824 cpumask_clear_cpu(cpu, mm_cpumask(mm)); 825 825 always_flush = true; 826 826 }