Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6021846ybi; Wed, 12 Jun 2019 12:33:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDa1BFTNF6P42tE6b/4Tu3FRgiBgcahPjXylyarBoXICkWrYDi1lo16jaultyGPZroxTdN X-Received: by 2002:a63:1666:: with SMTP id 38mr8771486pgw.428.1560368010030; Wed, 12 Jun 2019 12:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560368010; cv=none; d=google.com; s=arc-20160816; b=plBdGsHCSgX7dyNB9hTh3mbSuGgFQfHjua+V4y19quB94+HTf0Zn1GqUb77vhACVwU 2SI53s7ve4ky18oJH/9s3a06KWsNnIZTAjjtK0lL4T7B5HHcRx1mYPEPTHKfwHzcdyaH syMZGYkOL77SUogBsi9veo1lX+xYFDlVbT7FTs0uxksDt+Wq0J/MVd2yMaeceextoyw9 UIq2s+uX3rb4LFmf4GmN2RHgHCTyYbmiLYbiyhmMrhvMeEndSK8lc7RejxouGEsgKhNZ VOhI+hqegeI6OXdwUgBV5qnzQpbmkaodEkeYsdtqdw7bR9R6miM32MvqOQi3y00vz9uq 2vNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=15KNHaTJTaJbhn28IZoP2hNNxvDn9+emC5bk1kePwIc=; b=G+dkRmucrDFzOjFHfgxbANjRzDrgknkpMsVRU2VxsHxlYtWGDl7bRWhJAeBDIushK6 0YGxGA/zI44hpq31jeMZKmhQN6osSUTo+rW4ztUEzrWEif5Zw1/DmxNvam0JDC5Db/tL 6Sph4xUIk6XvKnXmYbMaVS6kfxi3pUw0dhH/LrVMccN3EbpRFnerxXQtJdA5TE7CjF1p G3pRoDg8hYZ6EKW4jp7mgGXLe1rWPx65kb2fig5KyG2zsq1d3rB4+le5JYorOpdrcbtR IWTkUs+7RVzp8ZI61ug23M1l6amkiHBAHfvNUYIgcjHCAhJo3tkj3pTqWrBlhaFxTOj9 AlcA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si593052pgj.191.2019.06.12.12.33.15; Wed, 12 Jun 2019 12:33:30 -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 S1728804AbfFLTcu (ORCPT + 99 others); Wed, 12 Jun 2019 15:32:50 -0400 Received: from shelob.surriel.com ([96.67.55.147]:50440 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728446AbfFLTcs (ORCPT ); Wed, 12 Jun 2019 15:32:48 -0400 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hb8z2-0001BN-0R; Wed, 12 Jun 2019 15:32:32 -0400 From: Rik van Riel To: peterz@infradead.org Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, kernel-team@fb.com, morten.rasmussen@arm.com, tglx@linutronix.de, dietmar.eggeman@arm.com, mgorman@techsingularity.com, vincent.guittot@linaro.org, Rik van Riel Subject: [PATCH 5/8] sched,cfs: use explicit cfs_rq of parent se helper Date: Wed, 12 Jun 2019 15:32:24 -0400 Message-Id: <20190612193227.993-6-riel@surriel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190612193227.993-1-riel@surriel.com> References: <20190612193227.993-1-riel@surriel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use an explicit "cfs_rq of parent sched_entity" helper in a few strategic places, where cfs_rq_of(se) may no longer point at the right runqueue once we flatten the hierarchical cgroup runqueues. No functional change. Signed-off-by: Rik van Riel --- kernel/sched/fair.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index dcc521d251e3..c6ede2ecc935 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -275,6 +275,15 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp) return grp->my_q; } +/* runqueue owned by the parent entity */ +static inline struct cfs_rq *group_cfs_rq_of_parent(struct sched_entity *se) +{ + if (se->parent) + return group_cfs_rq(se->parent); + + return &cfs_rq_of(se)->rq->cfs; +} + static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq) { struct rq *rq = rq_of(cfs_rq); @@ -3298,7 +3307,7 @@ static inline int propagate_entity_load_avg(struct sched_entity *se) gcfs_rq->propagate = 0; - cfs_rq = cfs_rq_of(se); + cfs_rq = group_cfs_rq_of_parent(se); add_tg_cfs_propagate(cfs_rq, gcfs_rq->prop_runnable_sum); @@ -7779,7 +7788,7 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) WRITE_ONCE(cfs_rq->h_load_next, NULL); for_each_sched_entity(se) { - cfs_rq = cfs_rq_of(se); + cfs_rq = group_cfs_rq_of_parent(se); WRITE_ONCE(cfs_rq->h_load_next, se); if (cfs_rq->last_h_load_update == now) break; @@ -7802,7 +7811,7 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) static unsigned long task_se_h_load(struct sched_entity *se) { - struct cfs_rq *cfs_rq = cfs_rq_of(se); + struct cfs_rq *cfs_rq = group_cfs_rq_of_parent(se); update_cfs_rq_h_load(cfs_rq); return div64_ul(se->avg.load_avg * cfs_rq->h_load, @@ -10159,7 +10168,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) struct sched_entity *se = &curr->se; for_each_sched_entity(se) { - cfs_rq = cfs_rq_of(se); + cfs_rq = group_cfs_rq_of_parent(se); entity_tick(cfs_rq, se, queued); } -- 2.20.1