From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753190AbdBPCg6 (ORCPT ); Wed, 15 Feb 2017 21:36:58 -0500 Received: from smtprelay0101.hostedemail.com ([216.40.44.101]:58458 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752864AbdBPCg5 (ORCPT ); Wed, 15 Feb 2017 21:36:57 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3872:3874:4250:4321:5007:6261:7875:7903:7974:10004:10400:10848:10967:11026:11232:11658:11914:12438:12555:12740:12760:12895:13069:13311:13357:13439:14096:14097:14181:14659:14721:21080:21324:21325:21451:30012:30054:30090:30091,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,LFtime:2,LUA_SUMMARY:none X-HE-Tag: group73_59795223bca3f X-Filterd-Recvd-Size: 2380 Date: Wed, 15 Feb 2017 21:36:53 -0500 From: Steven Rostedt To: Byungchul Park Cc: , , , , Subject: Re: [PATCH v2 2/2] sched/rt: Remove unnecessary condition in push_rt_task() Message-ID: <20170215213653.6f83513a@grimm.local.home> In-Reply-To: <1487210754-17252-2-git-send-email-byungchul.park@lge.com> References: <1487210754-17252-1-git-send-email-byungchul.park@lge.com> <1487210754-17252-2-git-send-email-byungchul.park@lge.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; 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 Thu, 16 Feb 2017 11:05:54 +0900 Byungchul Park wrote: > Once pick_next_pushable_task(rq) returns a task, it guarantees that > the task's cpu is rq->cpu, so task_cpu(next_task) is always rq->cpu if > task == next_task. Remove the redundant condition and make code simpler. > > pick_next_pushable_task(rq) has BUG_ON(rq_cpu != task_cpu(task)) when > it returns a task other than NULL, which means that task_cpu(task) must > be rq->cpu. So if task == next_task, then task_cpu(next_task) must be > rq->cpu as well. > > By this patch, unnecessary one branch and two LOAD operations in 'if' > statement can be avoided. > > Signed-off-by: Byungchul Park > --- > kernel/sched/rt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 4101f9d..5abd9a52 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -1820,7 +1820,7 @@ static int push_rt_task(struct rq *rq) > * pushing. > */ > task = pick_next_pushable_task(rq); > - if (task_cpu(next_task) == rq->cpu && task == next_task) { > + if (task == next_task) { Reviewed-by: Steven Rostedt (VMware) -- Steve > /* > * The task hasn't migrated, and is still the next > * eligible task, but we failed to find a run-queue