lkml.org 
[lkml]   [2015]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/2] sched/rt: Check to push the task when changing its affinity
On Sun,  8 Feb 2015 23:51:25 +0800
Xunlei Pang <pang.xunlei@linaro.org> wrote:


> + if (new_weight > 1 &&
> + rt_task(rq->curr) &&
> + !test_tsk_need_resched(rq->curr)) {
> + /*
> + * We own p->pi_lock and rq->lock. rq->lock might
> + * get released when doing direct pushing, however
> + * p->pi_lock is always held, so it's safe to assign
> + * the new_mask and new_weight to p below.
> + */
> + if (!task_running(rq, p)) {
> + cpumask_copy(&p->cpus_allowed, new_mask);
> + p->nr_cpus_allowed = new_weight;
> + direct_push = 1;
> + } else if (cpumask_test_cpu(task_cpu(p), new_mask)) {
> + cpumask_copy(&p->cpus_allowed, new_mask);
> + p->nr_cpus_allowed = new_weight;
> + if (!cpupri_find(&rq->rd->cpupri, p, NULL))
> + goto update;
> +
> + /*
> + * At this point, current task gets migratable most
> + * likely due to the change of its affinity, let's
> + * figure out if we can migrate it.
> + *
> + * Is there any task with the same priority as that
> + * of current task? If found one, we should resched.
> + * NOTE: The target may be unpushable.
> + */
> + if (p->prio == rq->rt.highest_prio.next) {
> + /* One target just in pushable_tasks list. */
> + requeue_task_rt(rq, p, 0);

What's the purpose of the requeue_task_rt() here?

> + preempt_push = 1;
> + } else if (rq->rt.rt_nr_total > 1) {
> + struct task_struct *next;
> +
> + requeue_task_rt(rq, p, 0);

And here? It may just be late and I'm tired, but it's not obvious to me.

Thanks,

-- Steve

> + next = peek_next_task_rt(rq);
> + if (next != p && next->prio == p->prio)
> + preempt_push = 1;
> + }
> + }
> + }
>


\
 
 \ /
  Last update: 2015-02-13 00:41    [W:0.052 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site