Re: [PATCH v7 1/4] spinlock: A new lockref structure for locklessupdate of refcount

From: Linus Torvalds
Date: Tue Sep 03 2013 - 17:40:01 EST


On Tue, Sep 3, 2013 at 2:34 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> I'll try to hack that up too, but it's looking like it really is just
> the "lock xadd", not the memory dependency chain..

Yeah, no difference: Better code generation with my quick hack for a
percpu spinlock:

â ffffffff81078e70 <lg_local_lock>:
0.59 â push %rbp
0.25 â mov %rsp,%rbp
0.07 â mov $0x100,%eax
97.55 â lock xadd %ax,%gs:(%rdi)
0.01 â movzbl %ah,%edx
â cmp %al,%dl
0.68 â â je 29
â nop
â20: pause
â mov %gs:(%rdi),%al
â cmp %dl,%al
â â jne 20
â29: pop %rbp
0.84 â â retq

but the actual cost is pretty much the same:

6.81% lg_local_lock

so it doesn't seem to be some odd weakness of the microarchitecture.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/