Re: [PATCH 0/1] mm: improve folio refcount scalability
From: Linus Torvalds
Date: Sun Mar 01 2026 - 16:23:36 EST
On Sun, 1 Mar 2026 at 12:26, Pedro Falcato <pfalcato@xxxxxxx> wrote:
>
> Here we can see that the optimistic cmpxchg still can't match the xadd/lock addl
> performance in single-thread, and degrades quickly and worse than straight up
> cmpxchg under load (perhaps presumably because of the cmpxchg miss).
Ok, thanks for doing the numbers. I'm (obviously) a bit surprised at
how badly cmpxchg does - it used to be noticeably worse than "lock
add" even for the non-contention case, but I thought that had long
since been fixed.
Clearly that's just not the case - and I had just been overly
optimistic that the "first cmpxchg failed, but second one gets the
value without losing the cacheline in between" would work reliably.
Ho humm. Maybe that "locked" flag is the best we can do.
Linus