Re: [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair

From: Abel Vesa
Date: Tue Apr 07 2015 - 13:25:40 EST


On Tue, Apr 7, 2015 at 7:55 PM, Mike Galbraith <umgwanakikbuti@xxxxxxxxx> wrote:
> On Tue, 2015-04-07 at 16:37 +0300, Abel Vesa wrote:
>> On Tue, Apr 7, 2015 at 1:30 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx
>> > wrote:
>> > On Mon, Apr 06, 2015 at 09:43:43PM +0300, Abel Vesa wrote:
>> > > This patch removes function wakeup_gran and its call by calling
>> > > directly
>> > > calc_delta_fair function with sysctl_sched_wakeup_granularity
>> > > and se as arguments.
>> >
>> > But why?
>>
>> I was thinking that maybe reducing another function call would be a
>> better idea.
>> I don't see what's the point of calling a 'wakeup_gran' just to
>> declare 'gran' as local variable and then
>> call calc_delta_fair instead of calling directly calc_delta_fair.
>> Plus, I think it seems more
>> readable to me. Of course, I might be wrong.
>
> I expected it be inlined by gcc, but that didn't happen with gcc-4.8.3.
>
> -Mike

well, I really don't know what to say but I got curious too
and I compiled it with:

gcc (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4

and then did a objdump and got this:

0000010c <wakeup_preempt_entity>:
10c: e92d4038 push {r3, r4, r5, lr}
110: e1c123d0 ldrd r2, [r1, #48] ; 0x30
114: e1c043d0 ldrd r4, [r0, #48] ; 0x30
118: e0544002 subs r4, r4, r2
11c: e0c55003 sbc r5, r5, r3
120: e3540001 cmp r4, #1
124: e2d53000 sbcs r3, r5, #0
128: ba00000b blt 15c <wakeup_preempt_entity+0x50>
12c: e5912000 ldr r2, [r1]
130: e59f3040 ldr r3, [pc, #64] ; 178
<wakeup_preempt_entity+0x6c>
134: e3520b01 cmp r2, #1024 ; 0x400
138: e5930000 ldr r0, [r3]
13c: 1a000008 bne 164 <wakeup_preempt_entity+0x58>
140: e1a02000 mov r2, r0
144: e3a03000 mov r3, #0
148: e1520004 cmp r2, r4
14c: e0d31005 sbcs r1, r3, r5
150: a3a00000 movge r0, #0
154: b3a00001 movlt r0, #1
158: e8bd8038 pop {r3, r4, r5, pc}
15c: e3e00000 mvn r0, #0
160: e8bd8038 pop {r3, r4, r5, pc}
164: e1a03001 mov r3, r1
168: e3a02b01 mov r2, #1024 ; 0x400
16c: e3a01000 mov r1, #0
170: ebffffa2 bl 0 <__calc_delta>
174: eafffff1 b 140 <wakeup_preempt_entity+0x34>
178: 00000000 .word 0x00000000

0000017c <sched_slice>:
.....

Now ofcourse, I'm not an ARM assembly language expert but I don't
think there is
any kind of branch instruction to something called 'wakeup_gran' , so I guess
Peter was right, at least this version of gcc says so.
--
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/