lkml.org 
[lkml]   [2014]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 5/6] sched/dl: Optimize select_task_rq_dl() for non-DL curr task
    Date
    When selecting the cpu for a waking DL task, if curr is a non-DL
    task which is bound only on this cpu, then we can give it a chance
    to select a different cpu for this DL task to avoid curr starving.

    Signed-off-by: pang.xunlei <pang.xunlei@linaro.org>
    ---
    kernel/sched/deadline.c | 14 ++++++++++----
    1 file changed, 10 insertions(+), 4 deletions(-)

    diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
    index 7b0b2d2..1f64d4a 100644
    --- a/kernel/sched/deadline.c
    +++ b/kernel/sched/deadline.c
    @@ -954,6 +954,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
    struct task_struct *curr;
    struct rq *rq;

    + if (p->nr_cpus_allowed == 1)
    + goto out;
    +
    if (sd_flag != SD_BALANCE_WAKE && sd_flag != SD_BALANCE_FORK)
    goto out;

    @@ -970,11 +973,14 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
    * can!) we prefer to send it somewhere else. On the
    * other hand, if it has a shorter deadline, we
    * try to make it stay here, it might be important.
    + *
    + * If the current task on @p's runqueue is a non-DL task,
    + * and this task is bound on current runqueue, then try to
    + * see if we can wake this DL task up on a different runqueue,
    */
    - if (unlikely(dl_task(curr)) &&
    - (curr->nr_cpus_allowed < 2 ||
    - !dl_entity_preempt(&p->dl, &curr->dl)) &&
    - (p->nr_cpus_allowed > 1)) {
    + if (unlikely(curr->nr_cpus_allowed < 2) ||
    + unlikely(dl_task(curr) &&
    + !dl_entity_preempt(&p->dl, &curr->dl))) {
    int target = find_later_rq(p);

    if (target != -1)
    --
    1.7.9.5


    \
     
     \ /
      Last update: 2014-11-04 12:21    [W:5.111 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site