[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150518200417.GC18673@twins.programming.kicks-ass.net>
Date: Mon, 18 May 2015 22:04:17 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: pang.xunlei@....com.cn
Cc: dedekind1@...il.com, juri.lelli@....com,
linux-kernel@...r.kernel.org, linux-kernel-owner@...r.kernel.org,
mgorman@...e.de, mingo@...nel.org, riel@...hat.com,
rostedt@...dmis.org
Subject: Re: [RFC][PATCH 3/4] sched: Change sched_class::set_cpus_allowed
calling context
On Mon, May 18, 2015 at 10:32:16AM +0200, Peter Zijlstra wrote:
> On Mon, May 18, 2015 at 03:37:43PM +0800, pang.xunlei@....com.cn wrote:
> > Hi Peter,
> >
> > With this modification, I think the pushing action in my previous patch
> > "Check to push the task away after its affinity was changed" will not
> > be able to be implemented inside sched_class::set_cpus_allowed().
>
> Ah, right, I knew there was a patch I needed to look at.
So basically you want to do:
+check_push:
+ if (weight > 1 &&
+ !task_running(rq, p) &&
+ !test_tsk_need_resched(rq->curr) &&
+ !cpumask_subset(new_mask, &p->cpus_allowed)) {
+ /* Update new affinity and try to push. */
+ cpumask_copy(&p->cpus_allowed, new_mask);
+ p->nr_cpus_allowed = weight;
+ push_rt_tasks(rq);
+ return true;
+ }
in set_cpus_allowed_rt(), which would not work because of us calling
put_prev_task(), which does enqueue_pushable_task() and would allow
pick_next_pushable_task() to select the current task, which would then
BUG_ON().
Note however that you already test for !task_running(), which precludes
that entire argument, because if @p is not running, we did not call
put_prev_task() etc..
So I think the above would still work; albeit it needs a comment on why
etc..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists