lkml.org 
[lkml]   [2014]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [tip:sched/core] sched: Push down pre_schedule() and idle_balance ()
On 02/12/2014 06:22 PM, Peter Zijlstra wrote:
[snip]
>
> Yes I think there might be a problem here because of how we re-arranged
> things. Let me brew of pot of tea and try to actually wake up.
>
> I suspect we might be good if we clear the need_resched flags before
> calling pick_next_task. Then any RT/DL task that gets moved here will
> set need resched, and we'll retry the pick_next_task loop.

That sounds better, some thing like this?



diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index fb9764f..56a2e1f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2688,8 +2688,8 @@ need_resched:
if (prev->on_rq || rq->skip_clock_update < 0)
update_rq_clock(rq);

- next = pick_next_task(rq, prev);
clear_tsk_need_resched(prev);
+ next = pick_next_task(rq, prev);
clear_preempt_need_resched();
rq->skip_clock_update = 0;

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 235cfa7..48a9500 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4784,7 +4784,18 @@ idle:
rq->idle_stamp = rq_clock(rq);
if (idle_balance(rq)) { /* drops rq->lock */
rq->idle_stamp = 0;
- goto again;
+ /*
+ * Before we start to pick one of the pulled fair entities, take
+ * care if some RT/DL tasks has been enqueued during the time
+ * we release rq-lock inside idle_balance().
+ *
+ * In such cases, since clear_tsk_need_resched() was done
+ * already, need_resched() will imply the request to sched-in
+ * the enqueued RT/DL tasks, so don't 'goto again' to make sure
+ * the priority.
+ */
+ if (rq->nr_running == rq->cfs.h_nr_running || !need_resched())
+ goto again;



I like tea BTW, drink every day :)
Regards,
Michael Wang

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>



\
 
 \ /
  Last update: 2014-02-13 05:01    [W:0.154 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site