Re: [PATCH] block: switch to atomic_t for request references

From: Linus Torvalds
Date: Tue Dec 07 2021 - 11:03:42 EST


On Tue, Dec 7, 2021 at 1:34 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> Now, it could be GCC generates atrociously bad code simply because it
> doesn't know it can use the flags from the XADD in which case we can
> look at doing an arch asm implementation.

That may help.

This thread started because of alleged performance problems with
refcount_t. No numbers, and maybe it was wrong, but they have been
seen before, so I wouldn't dismiss the issue.

What I've seen personally is the horrendous "multiple different calls
to overflow functions with different arguments", which makes
__refcount_add() do stupid things and blow up the code. All for
entirely pointless debugging code.

Linus