Re: [PATCH] percpu_counter : add percpu_counter_add_fast()

From: Andrew Morton
Date: Thu Oct 21 2010 - 19:18:14 EST


On Fri, 22 Oct 2010 00:58:14 +0200
Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:

> Then 39 instructions in hot path (no lock taken)

Wow, your compiler sucks.

.globl __percpu_counter_add
.type __percpu_counter_add, @function
__percpu_counter_add:
pushq %rbp #
movq %rsp, %rbp #,
pushq %r13 #
movq %rdi, %r13 # fbc, fbc
pushq %r12 #
pushq %rbx #
pushq %r10 #
movq 96(%rdi), %rbx # <variable>.counters, pcount
#APP
movl %gs:cpu_number,%eax # cpu_number, pfo_ret__
#NO_APP
cltq
addq __per_cpu_offset(,%rax,8), %rbx # __per_cpu_offset, pcount
movslq (%rbx),%rax #* pcount, tmp70
leaq (%rax,%rsi), %r12 #, count
movslq %edx,%rax # batch, batch
cmpq %rax, %r12 # batch, count
jge .L43 #,
negl %edx # batch
movslq %edx,%rax # batch, tmp74
cmpq %rax, %r12 # tmp74, count
jg .L45 #,
.L43:
movq %r13, %rdi # fbc, D.14396
call _raw_spin_lock #
addq %r12, 72(%r13) # count, <variable>.count
movq %r13, %rdi # fbc, D.14396
movl $0, (%rbx) #,* pcount
call _raw_spin_unlock #
jmp .L47 #
.L45:
movl %r12d, (%rbx) # count,* pcount
.L47:
popq %r9 #
popq %rbx #
popq %r12 #
popq %r13 #
leave
ret

--
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/