Messages in this thread | | | Date | Mon, 18 May 2015 22:04:17 +0200 | From | Peter Zijlstra <> | 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@zte.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..
| |