Re: [patch 2/3] atomics: Provide rcuref - scalable reference counting
From: Linus Torvalds
Date: Thu Mar 02 2023 - 14:36:33 EST
On Wed, Mar 1, 2023 at 5:05 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> The result of staring more is:
>
> get():
> 6b57: f0 41 83 45 40 01 lock addl $0x1,0x40(%r13)
> 6b5d: 0f 88 cd 00 00 00 js 6c30 // -> slowpath if negative
[ rest removed ]
Yeah, so this looks like I was hoping for.
That PREEMPT=y case of 'put() makes me slightly unhappy, and I'm
wondering if it can be improved with better placement of the
preempt_disable/enable, but apart from maybe some massaging to that I
don't see a good way to avoid it.
And the ugliness is mostly about the preemption side, not about the
refcount itself. I've looked at that "preempt_enable ->
preempt_schedule" code generation before, and I've disliked it before,
and I don't have an answer to it.
> but the actual network code does some sanity checking:
Ok. Not pretty. But at least it's just an xadd on the access itself,
there's just some extra noise around it.
Linus