Cheng Jian
54b933c6c9
sched/idle: Micro-optimize the idle loop
...
Move the loop-invariant calculation of 'cpu' in do_idle() out of the loop body,
because the current CPU is always constant.
This improves the generated code both on x86-64 and ARM64:
x86-64:
Before patch (execution in loop):
864: 0f ae e8 lfence
867: 65 8b 05 c2 38 f1 7e mov %gs:0x7ef138c2(%rip),%eax
86e: 89 c0 mov %eax,%eax
870: 48 0f a3 05 68 19 08 bt %rax,0x1081968(%rip)
877: 01
After patch (execution in loop):
872: 0f ae e8 lfence
875: 4c 0f a3 25 63 19 08 bt %r12,0x1081963(%rip)
87c: 01
ARM64:
Before patch (execution in loop):
c58: d5033d9f dsb ld
c5c: d538d080 mrs x0, tpidr_el1
c60: b8606a61 ldr w1, [x19,x0]
c64: 1100fc20 add w0, w1, #0x3f
c68: 7100003f cmp w1, #0x0
c6c: 1a81b000 csel w0, w0, w1, lt
c70: 13067c00 asr w0, w0, #6
c74: 93407c00 sxtw x0, w0
c78: f8607a80 ldr x0, [x20,x0,lsl #3 ]
c7c: 9ac12401 lsr x1, x0, x1
c80: 36000581 tbz w1, #0 , d30 <do_idle+0x128>
After patch (execution in loop):
c84: d5033d9f dsb ld
c88: f9400260 ldr x0, [x19]
c8c: ea14001f tst x0, x20
c90: 54000580 b.eq d40 <do_idle+0x138>
Signed-off-by: Cheng Jian <cj.chengjian@huawei.com>
[ Rewrote the title and the changelog. ]
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: huawei.libin@huawei.com
Cc: xiexiuqi@huawei.com
Link: http://lkml.kernel.org/r/1508930907-107755-1-git-send-email-cj.chengjian@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-10-26 08:31:29 +02:00
..
2017-10-09 10:39:52 -07:00
2017-09-22 08:14:45 -07:00
2017-08-22 18:43:23 -07:00
2017-03-02 08:42:34 +01:00
2017-09-29 10:06:45 +02:00
2017-05-12 15:57:15 -07:00
2017-09-28 12:18:59 +02:00
2017-06-20 10:42:19 +02:00
2017-09-29 10:10:20 +02:00
2017-09-29 01:26:13 +02:00
2017-09-07 21:00:52 -07:00
2017-10-04 08:34:01 -07:00
2017-10-26 08:31:29 +02:00
2017-10-10 11:43:29 +02:00
2017-10-10 11:43:29 +02:00
2017-09-04 19:05:15 -04:00
2017-05-23 10:01:37 +02:00
2017-05-03 11:05:15 -07:00
2017-05-03 11:05:15 -07:00
2017-08-16 16:48:34 -07:00
2017-09-05 09:46:59 -04:00
2017-09-03 20:21:24 -04:00
2017-05-02 10:16:05 -04:00
2017-09-14 17:37:26 -07:00
2017-01-12 07:01:56 -07:00
2017-07-15 20:46:47 -04:00
2017-07-31 13:09:49 +02:00
2017-10-06 08:36:41 -07:00
2017-07-12 16:26:00 -07:00
2017-05-18 10:30:19 -06:00
2017-03-02 08:42:39 +01:00
2017-09-29 13:43:15 -04:00
2017-09-23 16:50:20 -04:00
2017-10-03 17:54:24 -07:00
2017-09-25 16:37:11 +02:00
2017-07-10 16:32:34 -07:00
2017-05-08 17:15:10 -07:00
2017-08-10 12:28:59 +02:00
2017-07-10 16:32:34 -07:00
2017-10-03 17:54:25 -07:00
2017-09-08 18:26:51 -07:00
2017-07-18 11:38:04 +02:00
2017-07-12 16:26:02 -07:00
2017-07-12 16:26:02 -07:00
2017-07-12 16:26:00 -07:00
2017-09-08 18:26:51 -07:00
2017-07-08 11:05:35 +02:00
2017-07-12 16:25:59 -07:00
2017-08-31 16:33:15 -07:00
2017-03-02 08:42:39 +01:00
2017-09-08 18:26:51 -07:00
2017-10-03 17:54:25 -07:00
2017-07-25 15:08:32 +02:00
2017-02-24 17:46:56 -08:00
2017-03-13 15:57:41 -03:00
2017-05-26 10:10:37 +02:00
2017-08-17 10:40:26 +02:00
2017-10-03 17:54:26 -07:00
2017-07-20 07:43:58 -05:00
2017-08-21 12:47:31 -07:00
2017-03-02 08:42:39 +01:00
2017-07-24 14:30:28 -05:00
2017-05-02 11:38:06 -07:00
2017-09-27 22:51:12 -07:00
2017-09-11 18:34:47 -07:00
2017-09-08 18:26:48 -07:00
2017-10-04 10:53:54 +02:00
2017-04-11 09:06:32 +02:00
2017-03-08 09:18:02 +01:00
2017-05-26 10:10:36 +02:00
2017-07-20 07:46:07 -05:00
2017-09-04 19:05:15 -04:00
2017-10-06 08:36:41 -07:00
2017-07-25 10:08:58 -07:00
2017-05-08 17:15:12 -07:00
2017-07-25 13:04:45 -07:00
2017-03-02 08:42:35 +01:00
2017-03-02 08:42:39 +01:00
2017-03-06 15:26:37 -06:00
2017-03-02 08:42:31 +01:00
2017-09-08 18:26:50 -07:00
2017-08-29 15:14:38 +02:00
2017-07-20 07:43:58 -05:00
2017-03-02 08:42:29 +01:00
2017-03-03 01:45:36 +01:00
2017-03-02 08:42:38 +01:00
2017-09-28 12:24:54 +02:00
2017-10-04 11:30:50 +02:00
2017-09-06 21:59:31 -07:00