Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp28405ybd; Fri, 28 Jun 2019 13:52:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4+IHdS/K7VJvb6w1aPy3fLrti/tbDqSNKex9yL9Uyrl6f/0vIIClw+QA/2tkRJfNhSNha X-Received: by 2002:a17:90a:3ac2:: with SMTP id b60mr15736569pjc.74.1561755145570; Fri, 28 Jun 2019 13:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561755145; cv=none; d=google.com; s=arc-20160816; b=zx0iafptG+L4HnGW2FfDzLlrMW7TpEC3ZgFHoZ9sTDB0AZhOEHZIsUTI+4d5VYmOmp Dqa+aKWqRYIeU0hhuMNQ9MxCvl9poK+4KdJXIEGllmJvRRQIgWOpDrj9VgXvPG9K0GKy 3v4YjL1vQoV9bjTne5H0rs2cQBGtss5UUZcZARB1BVTy5edty4lrZ7K4dkoOs7HsDznr wfe55avD2q+UyzfbDkgX9/90whrhOY3OqmsR5rq6s2QTCK8OdC3gqfshzW2mlqOxEVAB wDZv+OqZeoqIicGORue3NsGvpPqgxrCKbk6xZI6PcK7auxPYVUliDrJpPryH5nD9UkYb 1mhQ== 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=791Js7FmEBjlGfDo5pvc5DrABibCqTZBs23Jw2ZvFJE=; b=uA5mOcaczJZkcQwS/nKpdeHKuYoB90zGCDg4uMnWvQivtpSnh51eLHteK9JJCNUzFY 1uOr6cFUFu3+ENdmHIERSZ5RJcBWS9sU/210UZqprD6UsN6j1jX5noGL6UOsCsgsl7Z4 vXToq5cqJ2h7M9TFhs8NZCFwqVwyPjJCJXcqcSx1bc58pGLoumayhB/k+UbIP77pfwdf wGYMX2i30pueK2TFceEqEBvGM6bD68F7wiK+WeCWuxrDVIQdELOVfjJTEY9A82/7OvfF S2jfXJ8LN7kdmwO4SPO9xcCX0p+n7pYmoy0RKpFD3TK4oErV+l9cbzT90u848fngfmZ/ fOCw== 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 h131si3038278pgc.236.2019.06.28.13.52.10; Fri, 28 Jun 2019 13:52:25 -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 S1726944AbfF1Ut7 (ORCPT + 99 others); Fri, 28 Jun 2019 16:49:59 -0400 Received: from shelob.surriel.com ([96.67.55.147]:38464 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbfF1Utg (ORCPT ); Fri, 28 Jun 2019 16:49:36 -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 1hgxo6-0007TL-Le; Fri, 28 Jun 2019 16:49:18 -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/10] sched,cfs: use explicit cfs_rq of parent se helper Date: Fri, 28 Jun 2019 16:49:09 -0400 Message-Id: <20190628204913.10287-7-riel@surriel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190628204913.10287-1-riel@surriel.com> References: <20190628204913.10287-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 e41feacc45d9..d48bff5118fc 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); @@ -3297,7 +3306,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); @@ -7778,7 +7787,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; @@ -7801,7 +7810,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, @@ -10148,7 +10157,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