From patchwork Wed Feb 26 11:19:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 25345 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 216BB20636 for ; Wed, 26 Feb 2014 11:19:48 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id jy13sf952563veb.10 for ; Wed, 26 Feb 2014 03:19:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=05NOpfrNbIBt77gVrdyVFKXHyvZbmDG6jqR7LbRONHI=; b=PbEk5EEk2jN07U6VrTLIEytJWpfsEqtYnj6iUzLddiwrDU4KpEgVv1GGQ0d3ChohyU f8oCCHy54T0tVQQsSGmSxPH0sK2byBDQQVOqjgUytHdVybbKVEuTpAf6FExzlx34XVtd QaS+AKUfvBMr9slrcgVwmk+Tzd9KBjx//5tIwMeieE1zab0ntfn8h1JP7Kp+kXg9GP1E 3zFR5EjryTPHLIE4xPzsiG7XU3CpeoxLmIRaef19gc4qO+xyUNmgVGSQldzzfENSRrlF f6noMDKzpDhffBMzA7+segO6+8Ebhi1jFPzyOsvn1x+5AAqXwnARfaVvwig8kakSFQB4 L9gw== X-Gm-Message-State: ALoCoQlUnGpzzYenJBZExhRNuldGh/Izt6MN3lH2FSPq6wnETsXhDyIg/CMVXPnSF+CGS9POesst X-Received: by 10.58.248.170 with SMTP id yn10mr2888560vec.17.1393413587559; Wed, 26 Feb 2014 03:19:47 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.18.166 with SMTP id 35ls162209qgf.3.gmail; Wed, 26 Feb 2014 03:19:47 -0800 (PST) X-Received: by 10.220.191.134 with SMTP id dm6mr5682957vcb.16.1393413587424; Wed, 26 Feb 2014 03:19:47 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id xn5si141127vdc.42.2014.02.26.03.19.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 03:19:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ld13so758294vcb.4 for ; Wed, 26 Feb 2014 03:19:47 -0800 (PST) X-Received: by 10.220.250.203 with SMTP id mp11mr5568994vcb.2.1393413587337; Wed, 26 Feb 2014 03:19:47 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp18187vcz; Wed, 26 Feb 2014 03:19:43 -0800 (PST) X-Received: by 10.68.231.169 with SMTP id th9mr5919791pbc.113.1393413582888; Wed, 26 Feb 2014 03:19:42 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mp8si751619pbc.82.2014.02.26.03.19.42; Wed, 26 Feb 2014 03:19:42 -0800 (PST) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751812AbaBZLTf (ORCPT + 26 others); Wed, 26 Feb 2014 06:19:35 -0500 Received: from service87.mimecast.com ([91.220.42.44]:54973 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbaBZLTe convert rfc822-to-8bit (ORCPT ); Wed, 26 Feb 2014 06:19:34 -0500 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 26 Feb 2014 11:19:32 +0000 Received: from [10.1.197.169] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 26 Feb 2014 11:19:35 +0000 Message-ID: <530DCDC5.1060406@arm.com> Date: Wed, 26 Feb 2014 11:19:33 +0000 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Peter Zijlstra CC: Ben Segall , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] sched: put rq's sched_avg under CONFIG_FAIR_GROUP_SCHED References: <1393328862-19997-1-git-send-email-dietmar.eggemann@arm.com> <20140225205253.GB18404@twins.programming.kicks-ass.net> In-Reply-To: <20140225205253.GB18404@twins.programming.kicks-ass.net> X-OriginalArrivalTime: 26 Feb 2014 11:19:35.0713 (UTC) FILETIME=[A14CC910:01CF32E4] X-MC-Unique: 114022611193202601 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dietmar.eggemann@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 25/02/14 20:52, Peter Zijlstra wrote: > On Tue, Feb 25, 2014 at 11:47:42AM +0000, Dietmar Eggemann wrote: >> +++ b/kernel/sched/sched.h >> @@ -630,7 +630,9 @@ struct rq { >> struct llist_head wake_list; >> #endif >> >> +#ifdef CONFIG_FAIR_GROUP_SCHED >> struct sched_avg avg; >> +#endif >> }; > > There is already a CONFIG_FAIR_GROUP_SCHED #ifdef in that structure; > does it make sense to move this variable in there instead of adding yet > another #ifdef? > I changed the patch accordingly. -- >8 -- Subject: [PATCH] sched: put rq's sched_avg under CONFIG_FAIR_GROUP_SCHED The struct sched_avg of struct rq is only used in case group scheduling is enabled inside __update_tg_runnable_avg() to update per-cpu representation of a task group. I.e. that there is no need to maintain the runnable avg of a rq in the !CONFIG_FAIR_GROUP_SCHED case. This patch guards struct sched_avg of struct rq and update_rq_runnable_avg() with CONFIG_FAIR_GROUP_SCHED. There is an extra empty definition for update_rq_runnable_avg() necessary for the !CONFIG_FAIR_GROUP_SCHED && CONFIG_SMP case. The function print_cfs_group_stats() which prints out struct sched_avg of struct rq is already guarded with CONFIG_FAIR_GROUP_SCHED. Signed-off-by: Dietmar Eggemann --- kernel/sched/fair.c | 13 +++++++------ kernel/sched/sched.h | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5f6ddbef80af..76c6513b6889 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2376,12 +2376,19 @@ static inline void __update_group_entity_contrib(struct sched_entity *se) se->avg.load_avg_contrib >>= NICE_0_SHIFT; } } + +static inline void update_rq_runnable_avg(struct rq *rq, int runnable) +{ + __update_entity_runnable_avg(rq_clock_task(rq), &rq->avg, runnable); + __update_tg_runnable_avg(&rq->avg, &rq->cfs); +} #else /* CONFIG_FAIR_GROUP_SCHED */ static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq, int force_update) {} static inline void __update_tg_runnable_avg(struct sched_avg *sa, struct cfs_rq *cfs_rq) {} static inline void __update_group_entity_contrib(struct sched_entity *se) {} +static inline void update_rq_runnable_avg(struct rq *rq, int runnable) {} #endif /* CONFIG_FAIR_GROUP_SCHED */ static inline void __update_task_entity_contrib(struct sched_entity *se) @@ -2480,12 +2487,6 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update) __update_cfs_rq_tg_load_contrib(cfs_rq, force_update); } -static inline void update_rq_runnable_avg(struct rq *rq, int runnable) -{ - __update_entity_runnable_avg(rq_clock_task(rq), &rq->avg, runnable); - __update_tg_runnable_avg(&rq->avg, &rq->cfs); -} - /* Add the load generated by se into cfs_rq's child load-average */ static inline void enqueue_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4be68da1fe00..b1fb1a62c52d 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -540,6 +540,8 @@ struct rq { #ifdef CONFIG_FAIR_GROUP_SCHED /* list of leaf cfs_rq on this cpu: */ struct list_head leaf_cfs_rq_list; + + struct sched_avg avg; #endif /* CONFIG_FAIR_GROUP_SCHED */ /* @@ -629,8 +631,6 @@ struct rq { #ifdef CONFIG_SMP struct llist_head wake_list; #endif - - struct sched_avg avg; }; static inline int cpu_of(struct rq *rq)