From patchwork Thu Jun 2 15:53:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 69192 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp189246qgf; Thu, 2 Jun 2016 08:53:42 -0700 (PDT) X-Received: by 10.98.21.82 with SMTP id 79mr5881758pfv.92.1464882822498; Thu, 02 Jun 2016 08:53:42 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si1155874pfb.102.2016.06.02.08.53.41; Thu, 02 Jun 2016 08:53:42 -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 S1753428AbcFBPxj (ORCPT + 31 others); Thu, 2 Jun 2016 11:53:39 -0400 Received: from foss.arm.com ([217.140.101.70]:46247 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752556AbcFBPxi (ORCPT ); Thu, 2 Jun 2016 11:53:38 -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 9CE16F; Thu, 2 Jun 2016 08:54:07 -0700 (PDT) Received: from [10.1.207.26] (unknown [10.1.207.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1AA803F253; Thu, 2 Jun 2016 08:53:35 -0700 (PDT) Subject: Re: [RFC PATCH 1/3] sched/fair: Aggregate task utilization only on root cfs_rq To: Juri Lelli References: <1464809962-25814-1-git-send-email-dietmar.eggemann@arm.com> <1464809962-25814-2-git-send-email-dietmar.eggemann@arm.com> <20160602092358.GC9340@e106622-lin> Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Vincent Guittot , Ben Segall , Morten Rasmussen , Yuyang Du From: Dietmar Eggemann Message-ID: <5750567F.6060601@arm.com> Date: Thu, 2 Jun 2016 16:53:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160602092358.GC9340@e106622-lin> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/06/16 10:23, Juri Lelli wrote: >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 218f8e83db73..212becd3708f 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -2705,6 +2705,7 @@ __update_load_avg(u64 now, int cpu, struct sched_avg *sa, >> u32 contrib; >> unsigned int delta_w, scaled_delta_w, decayed = 0; >> unsigned long scale_freq, scale_cpu; >> + int update_util = 0; >> >> delta = now - sa->last_update_time; >> /* >> @@ -2725,6 +2726,12 @@ __update_load_avg(u64 now, int cpu, struct sched_avg *sa, >> return 0; >> sa->last_update_time = now; >> >> + if (cfs_rq) { >> + if (&rq_of(cfs_rq)->cfs == cfs_rq) > > Maybe we can wrap this sort of checks in a static inline improving > readability? Something like this? diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 218f8e83db73..01b0fa689ef9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -251,6 +251,18 @@ static inline struct rq *rq_of(struct cfs_rq *cfs_rq) return cfs_rq->rq; } +/* cfs_rq "owned" by the root task group */ +static inline struct cfs_rq *root_rq_of(struct cfs_rq *cfs_rq) +{ + return &rq_of(cfs_rq)->cfs; +} + +/* Is this cfs_rq "owned" by the root task group ? */ +static inline bool rq_is_root(struct cfs_rq *cfs_rq) +{ + return root_rq_of(cfs_rq) == cfs_rq; +} + /* An entity is a task if it doesn't "own" a runqueue */ #define entity_is_task(se) (!se->my_q) @@ -376,6 +388,16 @@ static inline struct rq *rq_of(struct cfs_rq *cfs_rq) return container_of(cfs_rq, struct rq, cfs); } +static inline struct cfs_rq *root_rq_of(struct cfs_rq *cfs_rq) +{ + return cfs_rq; +} + +static inline bool rq_is_root(struct cfs_rq *cfs_rq) +{ + return true; +} + #define entity_is_task(se) 1