Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7347049ybi; Mon, 22 Jul 2019 11:25:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDeQzVFFSf3SEuPcL7dkq4RxNITL/30XpaUHfkGlAsb/aKTuMI8J0A34ZQFEOewJidXsjy X-Received: by 2002:a62:82c1:: with SMTP id w184mr1592015pfd.8.1563819951825; Mon, 22 Jul 2019 11:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563819951; cv=none; d=google.com; s=arc-20160816; b=poVPAsbe3sR0pHwJ7sGSBaAMq+CzgAMMxgih28jpB4q/ExEOTcAp/j7iLuZjfwkMvs diFvcr1PlwH/bcsulyzqubrcItCPj7DQmR3v1RKMnJHX/otTI9ojGdM6sh1K4n3eUCSq o9JQ7ss55HSOGSO5O8ycU3eXO0tDPaA2+2hJTDPCu2SITB2P5Ehb3+3P/bsrPnypi1au QsNhIhQAap9FrMjKNZglFaN4KxsD+FoendEqXB1qfYCmfIWsTukG1gTPaEHAZIv8XRvW 6ZVrI9rr9QmPol/lwZjqUwmvOtKjroDN7hVLC+TXoYTKwrzRwkHn0CCNrQD1PWETbbax xc/w== 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=gAXqB7IkVhkvPE5lmc2DpxlnqCl7QDuJARWpmSWGbWU=; b=S1fbslnNwszTy9oOtRVF7Kx99gt5fwLQphFn1ufnq7iv5GoQjIgS7MP0Z6Dl0EFlp8 z2YSSd4/MzUdbfVpfCbV8Zcxv92HR6WTocPpjh1Nc2Ip0pH75Bp+uzS8Q0jwF0KEtyLB uYXBBfDnmp3xiKft+jkZ8HNxGAsUzi00yYxdGNdUx1R57QgYfpDA30e+qzjgxoYxz8WX yE0oOpUzcuIELGn514DoXFBJ/KkYmqgDO3DYEPEh3UNaYBGbJSl4khy+TpH73pi2G61b cYvqw3vMaAs5g1buYSV2gKfSuvmb8aP8T2EvMd6uyDSD66oNmbPUrNO5ZthIO7TTsCP8 lH3Q== 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 x21si8903620pln.397.2019.07.22.11.25.36; Mon, 22 Jul 2019 11:25:51 -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 S1728550AbfGVRen (ORCPT + 99 others); Mon, 22 Jul 2019 13:34:43 -0400 Received: from shelob.surriel.com ([96.67.55.147]:37892 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727996AbfGVReY (ORCPT ); Mon, 22 Jul 2019 13:34:24 -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 1hpcC8-0003HL-7G; Mon, 22 Jul 2019 13:33:52 -0400 From: Rik van Riel To: linux-kernel@vger.kernel.org Cc: kernel-team@fb.com, pjt@google.com, dietmar.eggemann@arm.com, peterz@infradead.org, mingo@redhat.com, morten.rasmussen@arm.com, tglx@linutronix.de, mgorman@techsingularity.net, vincent.guittot@linaro.org, Rik van Riel Subject: [PATCH 06/14] sched,cfs: use explicit cfs_rq of parent se helper Date: Mon, 22 Jul 2019 13:33:40 -0400 Message-Id: <20190722173348.9241-7-riel@surriel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190722173348.9241-1-riel@surriel.com> References: <20190722173348.9241-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 d6a8aa78a948..39f7a2d810e1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -276,6 +276,15 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp) return grp->my_q; } +/* runqueue owned by the parent entity; the root cfs_rq for a top level se */ +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); +} + static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq) { struct rq *rq = rq_of(cfs_rq); @@ -3317,7 +3326,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); @@ -7794,7 +7803,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; @@ -7817,7 +7826,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, @@ -10164,7 +10173,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