Re: [PATCH 4/5] sched/rt: Consider deadline tasks in cpupri_find()

Peter Zijlstra
2015-01-27T14:18:15Z

On Tue, Jan 27, 2015 at 01:58:59PM +0100, Peter Zijlstra wrote:
> > @@ -103,24 +104,11 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p,
> > if (skip)
> > continue;
> >
> > - if (cpumask_any_and(&p->cpus_allowed, vec->mask) >= nr_cpu_ids)
> > + cpumask_and(lowest_mask, &p->cpus_allowed, vec->mask);
> > + cpumask_and(lowest_mask, lowest_mask, cp->cpudl->free_cpus);
> > + if (cpumask_any(lowest_mask) >= nr_cpu_ids)
> > continue;
> >

> > +++ b/kernel/sched/rt.c
> > @@ -1349,14 +1349,17 @@ out:
> > return cpu;
> > }
> >
> > +static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask);
> > static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
> > {
> > + struct cpumask *lowest_mask = this_cpu_cpumask_var_ptr(local_cpu_mask);
> > +
> > /*
> > * Current can't be migrated, useless to reschedule,
> > * let's hope p can move out.
> > */
> > if (rq->curr->nr_cpus_allowed == 1 ||
> > - !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
> > + !cpupri_find(&rq->rd->cpupri, rq->curr, lowest_mask))
> > return;
> >
> > /*
>
>
> Again; should you not put something useful in the mask before you pass
> it to cpupri_find()?

Similar to the other case; I can't read today. I only saw the
_and(lowest_mask, lowest_mask, ...) and figured it ought to be populated
before that.