From patchwork Fri Apr 29 19:32:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 66969 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp969241qge; Fri, 29 Apr 2016 12:33:40 -0700 (PDT) X-Received: by 10.66.132.103 with SMTP id ot7mr31742508pab.27.1461958417986; Fri, 29 Apr 2016 12:33:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si19563929paa.62.2016.04.29.12.33.37; Fri, 29 Apr 2016 12:33:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbcD2TdZ (ORCPT + 29 others); Fri, 29 Apr 2016 15:33:25 -0400 Received: from foss.arm.com ([217.140.101.70]:53141 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752653AbcD2TdX (ORCPT ); Fri, 29 Apr 2016 15:33:23 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB12F52B; Fri, 29 Apr 2016 12:33:24 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.207.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D27AE3F25F; Fri, 29 Apr 2016 12:33:21 -0700 (PDT) From: Dietmar Eggemann To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCH 6/7] sched/fair: Reorder code in update_sd_lb_stats() Date: Fri, 29 Apr 2016 20:32:43 +0100 Message-Id: <1461958364-675-7-git-send-email-dietmar.eggemann@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461958364-675-1-git-send-email-dietmar.eggemann@arm.com> References: <1461958364-675-1-git-send-email-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do the update of total load and total capacity of sched_domain statistics before detecting if it is the local group. This and the inclusion of sg=sg->next into the condition of the do...while loop makes the code easier to read. Signed-off-by: Dietmar Eggemann --- kernel/sched/fair.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e68b9eb5cb97..58da724b6ca4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6801,8 +6801,12 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd update_sg_lb_stats(env, sg, load_idx, local_group, sgs, &overload); + /* Update sd_lb_stats */ + sds->total_load += sgs->group_load; + sds->total_capacity += sgs->group_capacity; + if (local_group) - goto next_group; + continue; /* * In case the child domain prefers tasks go to siblings @@ -6826,13 +6830,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd sds->busiest_stat = *sgs; } -next_group: - /* Now, start updating sd_lb_stats */ - sds->total_load += sgs->group_load; - sds->total_capacity += sgs->group_capacity; - - sg = sg->next; - } while (sg != env->sd->groups); + } while (sg = sg->next, sg != env->sd->groups); if (env->sd->flags & SD_NUMA) env->fbq_type = fbq_classify_group(&sds->busiest_stat);