Commit e6f55fe7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 3636cfa7 4cb5ac26
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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;
	}