Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1267063

Re: [PATCH v5 2/2] sched: make update_cpu_load_nohz() consider missed ticks in NOHZ_FULL

From Byungchul Park <byungchul.park@lge.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 2/2] sched: make update_cpu_load_nohz() consider missed ticks in NOHZ_FULL
Date 2015-11-11 10:50 +0100
Message-ID <qtAcp-11f-7@gated-at.bofh.it> (permalink)
References <qt58B-68l-7@gated-at.bofh.it> <qt58C-68l-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Nov 10, 2015 at 09:36:02AM +0900, byungchul.park@lge.com wrote:
> From: Byungchul Park <byungchul.park@lge.com>
> 
> Usually tick can be stopped for an idle cpu in NOHZ. However in NOHZ_FULL,
> a non-idle cpu's tick also can be stopped. However, update_cpu_load_nohz()
> does not consider the case a non-idle cpu's tick has been stopped at all.
> 
> This patch makes the update_cpu_load_nohz() know if the calling path comes
> from NOHZ_FULL or idle NOHZ.
> 
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> ---
>  include/linux/sched.h    |    4 ++--
>  kernel/sched/fair.c      |   10 ++++++----
>  kernel/time/tick-sched.c |    8 ++++----
>  3 files changed, 12 insertions(+), 10 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 7760678..3d93756 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4419,10 +4419,11 @@ 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);
> +	unsigned long load = active ? weighted_cpuload(cpu_of(this_rq)) : 0;

Hello,

I added this part after you acked.. What do you think about this
modification?

>  	unsigned long pending_updates;
>  
>  	if (curr_jiffies == this_rq->last_load_update_tick)
> @@ -4433,10 +4434,11 @@ void update_cpu_load_nohz(void)
>  	if (pending_updates) {
>  		this_rq->last_load_update_tick = curr_jiffies;
>  		/*
> -		 * We were idle, this means load 0, the current load might be
> -		 * !0 due to remote wakeups and the sort.
> +		 * In the regular NOHZ case, we were idle, this means load 0.
> +		 * In the NOHZ_FULL case, we were non-idle, we should consider
> +		 * its weighted load.

This, too.

>  		 */
> -		__update_cpu_load(this_rq, 0, pending_updates, 0);
> +		__update_cpu_load(this_rq, load, pending_updates, active);

This, too.

Thank you,
byungchul

>  	}
>  	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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/2] sched: consider missed ticks when updating cpu load <byungchul.park@lge.com> - 2015-11-10 01:40 +0100
  [PATCH v5 2/2] sched: make update_cpu_load_nohz() consider missed ticks in NOHZ_FULL <byungchul.park@lge.com> - 2015-11-10 01:40 +0100
    Re: [PATCH v5 2/2] sched: make update_cpu_load_nohz() consider  missed ticks in NOHZ_FULL Byungchul Park <byungchul.park@lge.com> - 2015-11-11 10:50 +0100
  [PATCH v5 1/2] sched: make __update_cpu_load() handle NOHZ_FULL tickless <byungchul.park@lge.com> - 2015-11-10 01:40 +0100
  Re: [PATCH v5 0/2] sched: consider missed ticks when updating cpu  load Byungchul Park <byungchul.park@lge.com> - 2015-11-11 10:40 +0100
    Re: [PATCH v5 0/2] sched: consider missed ticks when updating cpu  load Byungchul Park <byungchul.park@lge.com> - 2015-11-12 08:10 +0100

csiph-web