Christoph Lameter
819a72af8d
percpucounter: Optimize __percpu_counter_add a bit through the use of this_cpu() options.
...
The this_cpu_* options can be used to optimize __percpu_counter_add a bit. Avoids
some address arithmetic and saves 12 bytes.
Before:
00000000000001d3 <__percpu_counter_add>:
1d3: 55 push %rbp
1d4: 48 89 e5 mov %rsp,%rbp
1d7: 41 55 push %r13
1d9: 41 54 push %r12
1db: 53 push %rbx
1dc: 48 89 fb mov %rdi,%rbx
1df: 48 83 ec 08 sub $0x8,%rsp
1e3: 4c 8b 67 30 mov 0x30(%rdi),%r12
1e7: 65 4c 03 24 25 00 00 add %gs:0x0,%r12
1ee: 00 00
1f0: 4d 63 2c 24 movslq (%r12),%r13
1f4: 48 63 c2 movslq %edx,%rax
1f7: 49 01 f5 add %rsi,%r13
1fa: 49 39 c5 cmp %rax,%r13
1fd: 7d 0a jge 209 <__percpu_counter_add+0x36>
1ff: f7 da neg %edx
201: 48 63 d2 movslq %edx,%rdx
204: 49 39 d5 cmp %rdx,%r13
207: 7f 1e jg 227 <__percpu_counter_add+0x54>
209: 48 89 df mov %rbx,%rdi
20c: e8 00 00 00 00 callq 211 <__percpu_counter_add+0x3e>
211: 4c 01 6b 18 add %r13,0x18(%rbx)
215: 48 89 df mov %rbx,%rdi
218: 41 c7 04 24 00 00 00 movl $0x0,(%r12)
21f: 00
220: e8 00 00 00 00 callq 225 <__percpu_counter_add+0x52>
225: eb 04 jmp 22b <__percpu_counter_add+0x58>
227: 45 89 2c 24 mov %r13d,(%r12)
22b: 5b pop %rbx
22c: 5b pop %rbx
22d: 41 5c pop %r12
22f: 41 5d pop %r13
231: c9 leaveq
232: c3 retq
After:
00000000000001d3 <__percpu_counter_add>:
1d3: 55 push %rbp
1d4: 48 63 ca movslq %edx,%rcx
1d7: 48 89 e5 mov %rsp,%rbp
1da: 41 54 push %r12
1dc: 53 push %rbx
1dd: 48 89 fb mov %rdi,%rbx
1e0: 48 8b 47 30 mov 0x30(%rdi),%rax
1e4: 65 44 8b 20 mov %gs:(%rax),%r12d
1e8: 4d 63 e4 movslq %r12d,%r12
1eb: 49 01 f4 add %rsi,%r12
1ee: 49 39 cc cmp %rcx,%r12
1f1: 7d 0a jge 1fd <__percpu_counter_add+0x2a>
1f3: f7 da neg %edx
1f5: 48 63 d2 movslq %edx,%rdx
1f8: 49 39 d4 cmp %rdx,%r12
1fb: 7f 21 jg 21e <__percpu_counter_add+0x4b>
1fd: 48 89 df mov %rbx,%rdi
200: e8 00 00 00 00 callq 205 <__percpu_counter_add+0x32>
205: 4c 01 63 18 add %r12,0x18(%rbx)
209: 48 8b 43 30 mov 0x30(%rbx),%rax
20d: 48 89 df mov %rbx,%rdi
210: 65 c7 00 00 00 00 00 movl $0x0,%gs:(%rax)
217: e8 00 00 00 00 callq 21c <__percpu_counter_add+0x49>
21c: eb 04 jmp 222 <__percpu_counter_add+0x4f>
21e: 65 44 89 20 mov %r12d,%gs:(%rax)
222: 5b pop %rbx
223: 41 5c pop %r12
225: c9 leaveq
226: c3 retq
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Reviewed-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2010-12-17 15:07:18 +01:00
..
2010-01-11 09:34:04 -08:00
2010-08-30 17:35:52 +10:00
2009-09-21 15:14:55 +02:00
2010-03-12 15:52:44 -08:00
2009-12-15 08:53:32 -08:00
2010-07-27 10:43:46 +01:00
2010-03-01 11:38:46 -08:00
2008-07-24 10:47:33 -07:00
2010-10-26 16:52:18 -07:00
2010-05-15 12:48:10 -07:00
2010-10-05 11:29:27 -07:00
2009-01-06 15:59:11 -08:00
2009-11-03 16:06:53 +01:00
2008-07-28 15:05:23 +02:00
2010-05-27 09:12:48 -07:00
2010-03-30 22:02:32 +09:00
2010-05-26 08:19:23 -07:00
2009-12-15 08:53:32 -08:00
2010-11-29 15:18:28 -08:00
2010-05-18 08:17:58 -07:00
2009-06-16 19:47:47 -07:00
2010-08-11 08:59:23 -07:00
2009-09-24 07:21:05 -07:00
2009-09-24 07:21:05 -07:00
2010-04-24 11:31:25 -07:00
2010-01-11 09:34:05 -08:00
2010-07-11 22:16:32 +02:00
2010-10-26 16:52:19 -07:00
2010-10-15 15:53:27 +02:00
2010-10-22 19:36:42 -07:00
2009-06-12 21:47:04 +09:30
2009-10-11 11:20:58 -07:00
2009-01-01 10:12:19 +10:30
2010-08-09 20:45:09 -07:00
2009-06-18 13:04:05 -07:00
2010-05-25 08:07:06 -07:00
2010-06-29 15:29:30 -07:00
2010-05-25 08:07:05 -07:00
2010-04-06 15:52:11 -07:00
2010-10-26 17:40:56 -07:00
2010-08-12 09:51:35 -07:00
2008-07-26 12:00:07 -07:00
2010-08-09 20:45:05 -07:00
2010-07-09 11:42:03 -07:00
2009-07-17 09:11:31 +10:00
2010-03-30 22:02:32 +09:00
2010-08-09 10:36:44 +01:00
2010-10-27 19:04:36 -07:00
2010-05-20 21:04:26 -05:00
2009-07-01 22:28:44 +02:00
2009-12-14 23:55:33 +01:00
2009-01-06 10:44:30 -08:00
2010-08-23 18:12:46 -07:00
2010-10-22 10:16:44 -07:00
2010-05-21 09:37:29 -07:00
2010-03-15 12:47:59 +01:00
2008-12-25 11:01:42 +11:00
2010-08-09 20:45:08 -07:00
2010-10-26 16:52:19 -07:00
2009-03-13 01:32:36 +01:00
2009-10-01 21:17:49 +02:00
2010-08-09 10:36:44 +01:00
2009-03-26 22:45:23 -07:00
2010-10-26 16:52:19 -07:00
2010-12-17 15:07:18 +01:00
2009-12-14 23:55:33 +01:00
2009-01-06 15:59:11 -08:00
2009-01-06 17:10:04 -08:00
2010-11-12 07:55:32 -08:00
2010-06-16 18:08:13 +02:00
2010-04-07 08:38:04 -07:00
2010-01-11 09:34:05 -08:00
2010-07-05 14:43:50 +02:00
2010-04-07 16:15:05 -07:00
2010-08-09 20:45:11 -07:00
2010-08-30 19:55:09 +02:00
2010-03-06 11:26:27 -08:00
2009-01-30 15:47:34 +01:00
2009-01-08 08:31:14 -08:00
2009-12-14 23:55:33 +01:00
2008-10-23 11:42:20 -05:00
2010-03-06 11:26:35 -08:00
2010-10-11 17:08:36 -04:00
2008-07-26 12:00:10 -07:00
2010-03-30 22:02:32 +09:00
2010-05-19 22:40:47 -04:00
2010-10-26 16:52:16 -07:00