Messages in this thread |  | | Date | Fri, 10 Apr 2015 11:12:53 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH] mutex: Speed up mutex_spin_on_owner() by not taking the RCU lock |
| |
* Ingo Molnar <mingo@kernel.org> wrote:
> 0000000000000030 <mutex_spin_on_owner.isra.4>: > 30: 48 3b 37 cmp (%rdi),%rsi > 33: 48 8d 4e 28 lea 0x28(%rsi),%rcx > 37: 75 4e jne 87 <mutex_spin_on_owner.isra.4+0x57> > 39: 55 push %rbp > 3a: 45 31 c0 xor %r8d,%r8d > 3d: 65 4c 8b 0c 25 00 00 mov %gs:0x0,%r9 > 44: 00 00 > 46: 48 89 e5 mov %rsp,%rbp > 49: 48 83 ec 10 sub $0x10,%rsp > 4d: eb 08 jmp 57 <mutex_spin_on_owner.isra.4+0x27> > 4f: 90 nop > 50: f3 90 pause > 52: 48 3b 37 cmp (%rdi),%rsi > 55: 75 29 jne 80 <mutex_spin_on_owner.isra.4+0x50> > 57: 44 89 c0 mov %r8d,%eax > 5a: 90 nop > 5b: 90 nop > 5c: 90 nop > 5d: 8b 11 mov (%rcx),%edx > 5f: 90 nop > 60: 90 nop > 61: 90 nop
Yeah, so what I missed here are those nops: placeholders for the STAC/CLAC instructions on x86... and this is what Linus mentioned about the clac() overhead.
But this could be solved I think: by adding a copy_from_kernel_inatomic() primitive which simply leaves out the STAC/CLAC sequence: as these are always guaranteed to be kernel addresses, the SMAP fault should not be generated.
Thanks,
Ingo
|  |