From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754557AbbGGGuZ (ORCPT ); Tue, 7 Jul 2015 02:50:25 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57626 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754392AbbGGGuQ (ORCPT ); Tue, 7 Jul 2015 02:50:16 -0400 Date: Mon, 6 Jul 2015 23:49:43 -0700 From: tip-bot for Boqun Feng Message-ID: Cc: tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, boqun.feng@gmail.com, linux-kernel@vger.kernel.org, srikar@linux.vnet.ibm.com Reply-To: hpa@zytor.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, srikar@linux.vnet.ibm.com, boqun.feng@gmail.com In-Reply-To: <1435847152-29543-1-git-send-email-boqun.feng@gmail.com> References: <1435847152-29543-1-git-send-email-boqun.feng@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Clean up the __sched_period() code Git-Commit-ID: 8e2b0bf397279878babcb39b021edcafe7c945eb 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: 8e2b0bf397279878babcb39b021edcafe7c945eb Gitweb: http://git.kernel.org/tip/8e2b0bf397279878babcb39b021edcafe7c945eb Author: Boqun Feng AuthorDate: Thu, 2 Jul 2015 22:25:52 +0800 Committer: Ingo Molnar CommitDate: Tue, 7 Jul 2015 08:46:10 +0200 sched/fair: Clean up the __sched_period() code Since commit: 4bf0b77158 ("sched: remove do_div() from __sched_slice()") ... the logic of __sched_period() can be implemented as a single if-else without any local variables, so this patch cleans it up with an if-else statement, which expresses the function's logic straightforwardly. Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Srikar Dronamraju Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1435847152-29543-1-git-send-email-boqun.feng@gmail.com Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a53a610..03ea05b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -616,15 +616,10 @@ static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se) */ static u64 __sched_period(unsigned long nr_running) { - u64 period = sysctl_sched_latency; - unsigned long nr_latency = sched_nr_latency; - - if (unlikely(nr_running > nr_latency)) { - period = sysctl_sched_min_granularity; - period *= nr_running; - } - - return period; + if (unlikely(nr_running > sched_nr_latency)) + return nr_running * sysctl_sched_min_granularity; + else + return sysctl_sched_latency; } /*