From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754230Ab3HPKXz (ORCPT ); Fri, 16 Aug 2013 06:23:55 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44345 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753386Ab3HPKW0 (ORCPT ); Fri, 16 Aug 2013 06:22:26 -0400 Message-Id: <20130816101545.220866770@infradead.org> User-Agent: quilt/0.60-1 Date: Fri, 16 Aug 2013 12:12:25 +0200 From: Peter Zijlstra To: Ingo Molnar , Joonsoo Kim Cc: linux-kernel@vger.kernel.org, Mike Galbraith , Paul Turner , Alex Shi , Preeti U Murthy , Vincent Guittot , Morten Rasmussen , Namhyung Kim , Joonsoo Kim , Peter Zijlstra Subject: [PATCH 4/6] sched, fair: Remove duplicate load_per_task computations References: <20130816101221.028189677@chello.nl> Content-Disposition: inline; filename=peterz-more-fbg-cleanups.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since we already compute (but don't store) the sgs load_per_task value in update_sg_lb_stats() we might as well store it and not re-compute it later on. Signed-off-by: Peter Zijlstra --- kernel/sched/fair.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4504,7 +4504,6 @@ static inline void update_sg_lb_stats(st { unsigned long nr_running, max_nr_running, min_nr_running; unsigned long load, max_cpu_load, min_cpu_load; - unsigned long avg_load_per_task = 0; int i; /* Tally up the load of all CPUs in the group */ @@ -4559,9 +4558,9 @@ static inline void update_sg_lb_stats(st * the hierarchy? */ if (sgs->sum_nr_running) - avg_load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; + sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; - if ((max_cpu_load - min_cpu_load) >= avg_load_per_task && + if ((max_cpu_load - min_cpu_load) >= sgs->load_per_task && (max_nr_running - min_nr_running) > 1) sgs->group_imb = 1; @@ -4807,15 +4806,7 @@ static inline void calculate_imbalance(s struct sg_lb_stats *this, *busiest; this = &sds->this_stat; - if (this->sum_nr_running) { - this->load_per_task = - this->sum_weighted_load / this->sum_nr_running; - } - busiest = &sds->busiest_stat; - /* busiest must have some tasks */ - busiest->load_per_task = - busiest->sum_weighted_load / busiest->sum_nr_running; if (busiest->group_imb) { busiest->load_per_task =