From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751515AbbBLXbi (ORCPT ); Thu, 12 Feb 2015 18:31:38 -0500 Received: from smtprelay0225.hostedemail.com ([216.40.44.225]:53677 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751201AbbBLXbh (ORCPT ); Thu, 12 Feb 2015 18:31:37 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2895:3138:3139:3140:3141:3142:3165:3354:3622:3865:3866:3867:3868:3870:3871:3872:3874:4362:5007:6261:7875:7904:9010:10004:10400:10848:10967:11026:11232:11658:11914:12043:12295:12296:12438:12517:12519:12663:12740:13069:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: bomb95_825c38c125a14 X-Filterd-Recvd-Size: 2649 Date: Thu, 12 Feb 2015 18:31:34 -0500 From: Steven Rostedt To: Xunlei Pang Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Juri Lelli Subject: Re: [PATCH v3 1/2] sched/rt: Check to push the task when changing its affinity Message-ID: <20150212183134.36506bec@gandalf.local.home> In-Reply-To: <1423410686-1928-1-git-send-email-pang.xunlei@linaro.org> References: <1423410686-1928-1-git-send-email-pang.xunlei@linaro.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 8 Feb 2015 23:51:25 +0800 Xunlei Pang 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; > + } > + } > + } >