From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220AbbJNJsf (ORCPT ); Wed, 14 Oct 2015 05:48:35 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:49185 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752845AbbJNJsc (ORCPT ); Wed, 14 Oct 2015 05:48:32 -0400 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 165.244.98.204 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com From: To: mingo@kernel.org, peterz@infradead.org CC: linux-kernel@vger.kernel.org, fweisbec@gmail.com, tglx@linutronix.de, Byungchul Park Subject: [PATCH v4 2/2] sched: consider missed ticks in full NOHZ Date: Wed, 14 Oct 2015 18:47:36 +0900 Message-ID: <1444816056-11886-3-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1444816056-11886-1-git-send-email-byungchul.park@lge.com> References: <1444816056-11886-1-git-send-email-byungchul.park@lge.com> X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB08/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/10/14 18:48:29, Serialize by Router on LGEKRMHUB08/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/10/14 18:48:29, Serialize complete at 2015/10/14 18:48:29 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Byungchul Park Even though the cpu is non-idle when its tick is stoped in full NOHZ, current "update_cpu_load" code considers as if the cpu has been idle unconditionally. It's wrong. This patch makes the "update_cpu_load" code know if the calling path comes from full NOHZ or idle NOHZ. Signed-off-by: Byungchul Park --- include/linux/sched.h | 4 ++-- kernel/sched/fair.c | 4 ++-- kernel/time/tick-sched.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 699228b..f1b59aa 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -177,9 +177,9 @@ extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); extern void calc_global_load(unsigned long ticks); #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) -extern void update_cpu_load_nohz(void); +extern void update_cpu_load_nohz(int active); #else -static inline void update_cpu_load_nohz(void) { } +static inline void update_cpu_load_nohz(int active) { } #endif extern unsigned long get_parent_ip(unsigned long addr); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 26473fc..63c5ffd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4428,7 +4428,7 @@ static void update_idle_cpu_load(struct rq *this_rq) /* * Called from tick_nohz_idle_exit() -- try and fix up the ticks we missed. */ -void update_cpu_load_nohz(void) +void update_cpu_load_nohz(int active) { struct rq *this_rq = this_rq(); unsigned long curr_jiffies = READ_ONCE(jiffies); @@ -4445,7 +4445,7 @@ void update_cpu_load_nohz(void) * We were idle, this means load 0, the current load might be * !0 due to remote wakeups and the sort. */ - __update_cpu_load(this_rq, 0, pending_updates, 0); + __update_cpu_load(this_rq, 0, pending_updates, active); } raw_spin_unlock(&this_rq->lock); } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 7c7ec45..515edf3 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -694,11 +694,11 @@ out: return tick; } -static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now) +static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now, int active) { /* Update jiffies first */ tick_do_update_jiffies64(now); - update_cpu_load_nohz(); + update_cpu_load_nohz(active); calc_load_exit_idle(); touch_softlockup_watchdog(); @@ -725,7 +725,7 @@ static void tick_nohz_full_update_tick(struct tick_sched *ts) if (can_stop_full_tick()) tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); else if (ts->tick_stopped) - tick_nohz_restart_sched_tick(ts, ktime_get()); + tick_nohz_restart_sched_tick(ts, ktime_get(), 1); #endif } @@ -916,7 +916,7 @@ void tick_nohz_idle_exit(void) tick_nohz_stop_idle(ts, now); if (ts->tick_stopped) { - tick_nohz_restart_sched_tick(ts, now); + tick_nohz_restart_sched_tick(ts, now, 0); tick_nohz_account_idle_ticks(ts); } -- 1.7.9.5