Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932722AbbERUEd (ORCPT ); Mon, 18 May 2015 16:04:33 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:60691 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932270AbbERUEa (ORCPT ); Mon, 18 May 2015 16:04:30 -0400 Date: Mon, 18 May 2015 22:04:17 +0200 From: Peter Zijlstra To: pang.xunlei@zte.com.cn Cc: dedekind1@gmail.com, juri.lelli@arm.com, linux-kernel@vger.kernel.org, linux-kernel-owner@vger.kernel.org, mgorman@suse.de, mingo@kernel.org, riel@redhat.com, rostedt@goodmis.org Subject: Re: [RFC][PATCH 3/4] sched: Change sched_class::set_cpus_allowed calling context Message-ID: <20150518200417.GC18673@twins.programming.kicks-ass.net> References: <20150515154333.712161952@infradead.org> <20150515154833.667516139@infradead.org> <20150518083216.GB21418@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150518083216.GB21418@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1595 Lines: 40 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.. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/