From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752660AbdHJMI0 (ORCPT ); Thu, 10 Aug 2017 08:08:26 -0400 Received: from terminus.zytor.com ([65.50.211.136]:60373 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbdHJMIY (ORCPT ); Thu, 10 Aug 2017 08:08:24 -0400 Date: Thu, 10 Aug 2017 05:04:52 -0700 From: tip-bot for Viresh Kumar Message-ID: Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, viresh.kumar@linaro.org, vincent.guittot@linaro.org, tglx@linutronix.de, torvalds@linux-foundation.org Reply-To: tglx@linutronix.de, viresh.kumar@linaro.org, vincent.guittot@linaro.org, torvalds@linux-foundation.org, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org In-Reply-To: <000903ab3df3350943d3271c53615893a230dc95.1495603536.git.viresh.kumar@linaro.org> References: <000903ab3df3350943d3271c53615893a230dc95.1495603536.git.viresh.kumar@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Avoid checking cfs_rq->nr_running twice Git-Commit-ID: 9674f5cad22a590c865a330ce333026b9f9c078b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 9674f5cad22a590c865a330ce333026b9f9c078b Gitweb: http://git.kernel.org/tip/9674f5cad22a590c865a330ce333026b9f9c078b Author: Viresh Kumar AuthorDate: Wed, 24 May 2017 10:59:55 +0530 Committer: Ingo Molnar CommitDate: Thu, 10 Aug 2017 12:18:11 +0200 sched/fair: Avoid checking cfs_rq->nr_running twice Rearrange pick_next_task_fair() a bit to avoid checking cfs_rq->nr_running twice for the case where FAIR_GROUP_SCHED is enabled and the previous task doesn't belong to the fair class. Signed-off-by: Viresh Kumar Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vincent Guittot Cc: linaro-kernel@lists.linaro.org Link: http://lkml.kernel.org/r/000903ab3df3350943d3271c53615893a230dc95.1495603536.git.viresh.kumar@linaro.org Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 27d425e..30fd196 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6187,10 +6187,10 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf int new_tasks; again: -#ifdef CONFIG_FAIR_GROUP_SCHED if (!cfs_rq->nr_running) goto idle; +#ifdef CONFIG_FAIR_GROUP_SCHED if (prev->sched_class != &fair_sched_class) goto simple; @@ -6220,11 +6220,17 @@ again: /* * This call to check_cfs_rq_runtime() will do the * throttle and dequeue its entity in the parent(s). - * Therefore the 'simple' nr_running test will indeed + * Therefore the nr_running test will indeed * be correct. */ - if (unlikely(check_cfs_rq_runtime(cfs_rq))) + if (unlikely(check_cfs_rq_runtime(cfs_rq))) { + cfs_rq = &rq->cfs; + + if (!cfs_rq->nr_running) + goto idle; + goto simple; + } } se = pick_next_entity(cfs_rq, curr); @@ -6264,12 +6270,8 @@ again: return p; simple: - cfs_rq = &rq->cfs; #endif - if (!cfs_rq->nr_running) - goto idle; - put_prev_task(rq, prev); do {