Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6021651ybi; Wed, 12 Jun 2019 12:33:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHlbK5+6OnT0idcQmTXQEps+YdPfHauOPB9PcPzVTTkXKJpWq1uNKkDQMKKQhmazha9OxO X-Received: by 2002:a65:50cb:: with SMTP id s11mr26388599pgp.371.1560367995072; Wed, 12 Jun 2019 12:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560367995; cv=none; d=google.com; s=arc-20160816; b=dbAv2A7PX5vjxdlecJkV9243T20GC0CI8KPpgqAXh0zA0uW1Hl42fBIvepT2zeTRyU 9+QGqVv6Zju19vddlSwv66aN93wk5zan4h7DEG9SRoSj0B1CEk8i9ViUe5v3wTr3+SOO aLPMZKEEtgtlfjOaoDHkh7mKo60HHqhLbphcG5OF9qeVL73et6g0l/khje6x4a+Krf9r P3PFF9Jr7/vMel9wJA7q47At4/D9/kGajEQl/CTNHyvmulOtgrDYm3wDI2NB90qin6Hg iIb8vPVm7KKzt4x5XBDK4EePgtfbSHQ6QY+F19jRSZTIBWTjMvQM22hIrtUxtD1SRh8Q v0xg== 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=MSJgHf4Pz+JS0h4Aa+MV3nQ+lmPKbpYvKtB16qCiccY=; b=bmkhtUuDmBPrYQEDxNbn9mgmK3nkPcULN/EnRzKqXQ4A9PgQVDefKKYxkoNebqQtQT 3r3Fw0dZe1x38V2edfxaE3Jz7KlRWrKXN4Uu/QY6k2ZFvsJB1iQnqr40sEoAgdyqc2Pm A3+PuTOFX0sUvuW/h/Ze3LSsOMQebNOOvLHyJmYd1bweWDsQETbaoRRxFEHqrsXhwX7X a8m1m/M4Veav6jF1MzJ38+5MxiUstD/cy8vr3pQs9fHAzHiyzjwtxQ2PQJby2FnWVnwg +4rnmE4cRoHusX616ifGLB34C7JE2IsaCDeg/HBFqptxFaEPr23feGGuDqT1XOr6A/Q3 qOQg== 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 b6si574087pfa.36.2019.06.12.12.32.58; Wed, 12 Jun 2019 12:33:15 -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 S2387853AbfFLTct (ORCPT + 99 others); Wed, 12 Jun 2019 15:32:49 -0400 Received: from shelob.surriel.com ([96.67.55.147]:50394 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727419AbfFLTcs (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 1hb8z1-0001BN-RO; Wed, 12 Jun 2019 15:32:31 -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 1/8] sched: introduce task_se_h_load helper Date: Wed, 12 Jun 2019 15:32:20 -0400 Message-Id: <20190612193227.993-2-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 Sometimes the hierarchical load of a sched_entity needs to be calculated. Split out task_h_load into a task_se_h_load that takes a sched_entity pointer as its argument, and a task_h_load wrapper that calls task_se_h_load. No functional changes. Signed-off-by: Rik van Riel --- kernel/sched/fair.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f35930f5e528..df624f7a68e7 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -706,6 +706,7 @@ static u64 sched_vslice(struct cfs_rq *cfs_rq, struct sched_entity *se) #ifdef CONFIG_SMP static int select_idle_sibling(struct task_struct *p, int prev_cpu, int cpu); +static unsigned long task_se_h_load(struct sched_entity *se); static unsigned long task_h_load(struct task_struct *p); static unsigned long capacity_of(int cpu); @@ -7833,14 +7834,19 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) } } -static unsigned long task_h_load(struct task_struct *p) +static unsigned long task_se_h_load(struct sched_entity *se) { - struct cfs_rq *cfs_rq = task_cfs_rq(p); + struct cfs_rq *cfs_rq = cfs_rq_of(se); update_cfs_rq_h_load(cfs_rq); - return div64_ul(p->se.avg.load_avg * cfs_rq->h_load, + return div64_ul(se->avg.load_avg * cfs_rq->h_load, cfs_rq_load_avg(cfs_rq) + 1); } + +static unsigned long task_h_load(struct task_struct *p) +{ + return task_se_h_load(&p->se); +} #else static inline void update_blocked_averages(int cpu) { @@ -7865,6 +7871,11 @@ static inline void update_blocked_averages(int cpu) rq_unlock_irqrestore(rq, &rf); } +static unsigned long task_se_h_load(struct sched_entity *se) +{ + return se->avg.load_avg; +} + static unsigned long task_h_load(struct task_struct *p) { return p->se.avg.load_avg; -- 2.20.1