Received: by 10.192.165.148 with SMTP id m20csp1267229imm; Thu, 10 May 2018 08:06:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqtnrpWqmvg27Sp/nh0IjFO6kByHSs4gL7FpOqhWPBuOz3YSUlyYpZBtPAXd2KMdA1Sow5j X-Received: by 2002:a17:902:7046:: with SMTP id h6-v6mr1742229plt.249.1525964815074; Thu, 10 May 2018 08:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525964815; cv=none; d=google.com; s=arc-20160816; b=L7qjdrDWJKYRAxA7Iv+hOCJMoBT56LuP6kmRHbfAkaYzqSBJa/MgHmlXY9TokkcmD7 8HLDcgzBRavZKfRathptL1sdUtROA4TyoCX2DKjy2uZ6IQfZt54nk6cdDoB2giQNzZcp EIFNUMR0UbFjRzpHhgA7duQZlBGmSGFXxZOENSUa3vGjZ+jZo30yhcqLqXxEJTownKy9 1162ZUQFPpS2a87uqkbTpSO0d+6r8aCHp7JmKKcGxpl9QS+H5LZ+1GVMUxzkvu+GRL79 aXqoYtfF0XRyHupaKFlXoQw2Kxm034nHeQwg+WAz8Z+UxXd2UMl4xOnmY81auB6h9zzq Ptaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Rjey50cCCPl3CO4nVmlZ0hNH5cahq96amFQCUcJSIIg=; b=RsSxMbZwo9HY51D7V7U05EZxzdNSoPwwP3+NT0SA0JyDunQC3f7+Rnro8dkM6UHZz2 eRPybv8Sz6ya1Tr+dY0/Gt+rCb+YxwpWMpcHgWzFj+GFYUYwYYrHmAUM2TuudJfVKCAR xfnGEy/Rl3khJHjzm/AeJWkC0qJ2dOJxnjPLgaP5Q+VRMSW5a8bHSY4fxtKmOqUvbxlv pBVIB5jBVYb0DwhKmBF+Y2BMGAnTx1PE6XhUEn6rCWPVzCAHKmnalo8FcIL5Bpan287n aw+vs2LtUZAsE0lLFF70oCvHwoyaxsu/4NpBETeCQ0p+A52fU1HWrUFtHm2MkaRBZ0RH vXuQ== 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 a187-v6si872575pgc.238.2018.05.10.08.06.39; Thu, 10 May 2018 08:06:55 -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 S966173AbeEJPGS (ORCPT + 99 others); Thu, 10 May 2018 11:06:18 -0400 Received: from foss.arm.com ([217.140.101.70]:57338 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965537AbeEJPGN (ORCPT ); Thu, 10 May 2018 11:06:13 -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 F1ABA1650; Thu, 10 May 2018 08:06:12 -0700 (PDT) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BDDC83F23C; Thu, 10 May 2018 08:06:10 -0700 (PDT) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Joel Fernandes , Steve Muckle Subject: [PATCH 2/3] sched/fair: util_est: update before schedutil Date: Thu, 10 May 2018 16:05:52 +0100 Message-Id: <20180510150553.28122-3-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180510150553.28122-1-patrick.bellasi@arm.com> References: <20180510150553.28122-1-patrick.bellasi@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a task is enqueue the estimated utilization of a CPU is updated to better support the selection of the required frequency. However, schedutil is (implicitly) updated by update_load_avg() which always happens before util_est_{en,de}queue(), thus potentially introducing a latency between estimated utilization updates and frequency selections. Let's update util_est at the beginning of enqueue_task_fair(), which will ensure that all schedutil updates will see the most updated estimated utilization value for a CPU. Reported-by: Vincent Guittot Signed-off-by: Patrick Bellasi Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Vincent Guittot Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org --- kernel/sched/fair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1f6a23a5b451..01dfc47541e6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5356,6 +5356,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) struct cfs_rq *cfs_rq; struct sched_entity *se = &p->se; + /* Estimated utilization must be updated before schedutil */ + util_est_enqueue(&rq->cfs, p); + /* * If in_iowait is set, the code below may not trigger any cpufreq * utilization updates, so do it here explicitly with the IOWAIT flag @@ -5397,7 +5400,6 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) if (!se) add_nr_running(rq, 1); - util_est_enqueue(&rq->cfs, p); hrtick_update(rq); } -- 2.15.1