Merge tag 'locking-urgent-2025-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fix from Ingo Molnar:
 "Fix (well, cut in half) a futex performance regression on PowerPC"

* tag 'locking-urgent-2025-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  futex: Optimize per-cpu reference counting
This commit is contained in:
Linus Torvalds
2025-11-08 08:51:22 -08:00

View File

@@ -1680,10 +1680,10 @@ static bool futex_ref_get(struct futex_private_hash *fph)
{
struct mm_struct *mm = fph->mm;
guard(rcu)();
guard(preempt)();
if (smp_load_acquire(&fph->state) == FR_PERCPU) {
this_cpu_inc(*mm->futex_ref);
if (READ_ONCE(fph->state) == FR_PERCPU) {
__this_cpu_inc(*mm->futex_ref);
return true;
}
@@ -1694,10 +1694,10 @@ static bool futex_ref_put(struct futex_private_hash *fph)
{
struct mm_struct *mm = fph->mm;
guard(rcu)();
guard(preempt)();
if (smp_load_acquire(&fph->state) == FR_PERCPU) {
this_cpu_dec(*mm->futex_ref);
if (READ_ONCE(fph->state) == FR_PERCPU) {
__this_cpu_dec(*mm->futex_ref);
return false;
}