* [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair
@ 2015-04-06 18:43 Abel Vesa
2015-04-07 10:30 ` Peter Zijlstra
0 siblings, 1 reply; 5+ messages in thread
From: Abel Vesa @ 2015-04-06 18:43 UTC (permalink / raw)
To: mingo, peterz; +Cc: linux-kernel, Abel Vesa
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.
Signed-off-by: Abel Vesa <abelvesa@gmail.com>
---
kernel/sched/fair.c | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 46855d0..63a4051 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4927,27 +4927,6 @@ migrate_task_rq_fair(struct task_struct *p, int next_cpu)
}
#endif /* CONFIG_SMP */
-static unsigned long
-wakeup_gran(struct sched_entity *curr, struct sched_entity *se)
-{
- unsigned long gran = sysctl_sched_wakeup_granularity;
-
- /*
- * Since its curr running now, convert the gran from real-time
- * to virtual-time in his units.
- *
- * By using 'se' instead of 'curr' we penalize light tasks, so
- * they get preempted easier. That is, if 'se' < 'curr' then
- * the resulting gran will be larger, therefore penalizing the
- * lighter, if otoh 'se' > 'curr' then the resulting gran will
- * be smaller, again penalizing the lighter task.
- *
- * This is especially important for buddies when the leftmost
- * task is higher priority than the buddy.
- */
- return calc_delta_fair(gran, se);
-}
-
/*
* Should 'se' preempt 'curr'.
*
@@ -4970,7 +4949,22 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
if (vdiff <= 0)
return -1;
- gran = wakeup_gran(curr, se);
+ /*
+ * Since its curr running now, convert the gran from real-time
+ * to virtual-time in his units.
+ *
+ * By using 'se' instead of 'curr' we penalize light tasks, so
+ * they get preempted easier. That is, if 'se' < 'curr' then
+ * the resulting gran will be larger, therefore penalizing the
+ * lighter, if otoh 'se' > 'curr' then the resulting gran will
+ * be smaller, again penalizing the lighter task.
+ *
+ * This is especially important for buddies when the leftmost
+ * task is higher priority than the buddy.
+ */
+
+ gran = calc_delta_fair(sysctl_sched_wakeup_granularity, se);
+
if (vdiff > gran)
return 1;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair
2015-04-06 18:43 [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair Abel Vesa
@ 2015-04-07 10:30 ` Peter Zijlstra
2015-04-07 13:37 ` Abel Vesa
0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2015-04-07 10:30 UTC (permalink / raw)
To: Abel Vesa; +Cc: mingo, linux-kernel
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair
2015-04-07 10:30 ` Peter Zijlstra
@ 2015-04-07 13:37 ` Abel Vesa
2015-04-07 16:55 ` Mike Galbraith
0 siblings, 1 reply; 5+ messages in thread
From: Abel Vesa @ 2015-04-07 13:37 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: mingo, linux-kernel
On Tue, Apr 7, 2015 at 1:30 PM, Peter Zijlstra <peterz@infradead.org> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair
2015-04-07 13:37 ` Abel Vesa
@ 2015-04-07 16:55 ` Mike Galbraith
2015-04-07 17:25 ` Abel Vesa
0 siblings, 1 reply; 5+ messages in thread
From: Mike Galbraith @ 2015-04-07 16:55 UTC (permalink / raw)
To: Abel Vesa; +Cc: Peter Zijlstra, mingo, linux-kernel
On Tue, 2015-04-07 at 16:37 +0300, Abel Vesa wrote:
> On Tue, Apr 7, 2015 at 1:30 PM, Peter Zijlstra <peterz@infradead.org
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair
2015-04-07 16:55 ` Mike Galbraith
@ 2015-04-07 17:25 ` Abel Vesa
0 siblings, 0 replies; 5+ messages in thread
From: Abel Vesa @ 2015-04-07 17:25 UTC (permalink / raw)
To: Mike Galbraith; +Cc: Peter Zijlstra, mingo, linux-kernel
On Tue, Apr 7, 2015 at 7:55 PM, Mike Galbraith <umgwanakikbuti@gmail.com> 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@infradead.org
>> > 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-07 17:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-06 18:43 [PATCH] sched/core: Remove wakeup_gran with single call calc_delta_fair Abel Vesa
2015-04-07 10:30 ` Peter Zijlstra
2015-04-07 13:37 ` Abel Vesa
2015-04-07 16:55 ` Mike Galbraith
2015-04-07 17:25 ` Abel Vesa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.