Received: by 10.223.185.111 with SMTP id b44csp108993wrg; Fri, 9 Mar 2018 01:55:20 -0800 (PST) X-Google-Smtp-Source: AG47ELvFtGJYT/WtDW7dCgxk1qY+Zioov3Bq29kNQjaMZl+QTEn9Z/fccDSPtSjoNhlUQjHvJstb X-Received: by 10.101.73.197 with SMTP id t5mr24125559pgs.426.1520589320075; Fri, 09 Mar 2018 01:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520589320; cv=none; d=google.com; s=arc-20160816; b=wHaRl5Lwd1taQLjTca9sqjUiFwPym/pxoqxE1AkV+d7o0mcorpyYpBGrn34pHzBy4c J6sV0hlP+WjDp1L1I5oULxA43MV3fBe+Cnmj+7qBcZkw/FNG2yxTec09bL2nXbbsuZIi Esz13j1mVJ1ZKowYanFnn3NwokLqtPbnbDet5kB5Xhjoi47jDUQQePj2bTmQ9j6tAKZr Nz7EfZ0WhyL8DIKMpvH0BZWKUPIGkHR2ZRNFTPJFV3d6QOl1r/Ie0qRnMBxWG8dlyHd4 Gq5epH15FgkYYn+SzENXVDnO2wkVVlCedmmwmXhrgBDjHG5a/8W9JmfsqswVrlDIMSV/ djiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CZagkZ6kQQsRFGosd7XI48p1JRxqEtVuxI+qR0aocY4=; b=ro/zvaM2nxj6yYRllujSe6tlkop8Y8p7twKMJJJLCNbZOsTfB+69dfJJyxsc3oXjYi 3DJ86a+bGBQbNqmtfsmvzZKyWxmOQIPDwUT5kBidfJvhw9lJj1jtzg6tfBi+z2SDrv4S oj2YeFbD1VTNqFOt56IZEG+qgsHpjYfI6rQbxF0ern5HusIUY/ywnJ3WHLheXlbVKWu6 Xbuvgtr8ry7CjeY79SpIvLu0CyXrbrfsemvAwLP9hRCgCwvzik1VLoLN+Yh+SpDxsKdo BqkyDgzYMUqgp/PiBEgBMSdpCGnk3Ir2f9iK9Mj/OL6SO9w6h7RdtLqfTmOSSa4vbSiM +huw== 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 3-v6si601180plo.316.2018.03.09.01.55.06; Fri, 09 Mar 2018 01:55:20 -0800 (PST) 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 S1751218AbeCIJw6 (ORCPT + 99 others); Fri, 9 Mar 2018 04:52:58 -0500 Received: from foss.arm.com ([217.140.101.70]:49298 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751146AbeCIJwy (ORCPT ); Fri, 9 Mar 2018 04:52:54 -0500 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 11C9F80D; Fri, 9 Mar 2018 01:52:54 -0800 (PST) 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 8593A3F5BA; Fri, 9 Mar 2018 01:52:51 -0800 (PST) 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 , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: [PATCH v6 0/4] Utilization estimation (util_est) for FAIR tasks Date: Fri, 9 Mar 2018 09:52:41 +0000 Message-Id: <20180309095245.11071-1-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.15.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, here is an update of [1], based on today's tip/sched/core [2], which mainly adds some code cleanups suggested by Peter as well as fixes compilation for !CONFIG_SMP systems. Most notably: a) The util_est's update flag has been renamed into UTIL_AVG_UNCHANGED, which seems to better match its usages. b) The cpu_util_est() function has been removed to reduce cluttering by folding its code directly into cpu_util(). This last function is thus now always returning the estimated utilization of a CPU, unless this sched feature is disabled. c) Not necessary READ_ONCE() have been removed from rq-lock protected code paths. For util_est variable, that we read/modify/write only from rq-lock protected, code we keep just the WRITE_ONCE() barriers, which are still required for synchronization with lockless readers. The READ_ONCE() have been instead maintained in all the getter functions, like for example task_util() and cpu_util(), which can potentially be used by lockless code. e.g. schedutil or load-balancer. Results on both x86_64 and ARM (Android) targets, which have been collected and reported in previous postings [1,3], show negligible overheads, especially compared to the corresponding power/performance benefits on mobile platforms, where this feature helps to reduce the performance gap between PELT and another other out-of-tree load tracking solution. Best, Patrick .:: Changelog ============= Changes in v6: - remove READ_ONCE from rq-lock protected code paths - folds cpu_util_est code into cpu_util and update its documentation - change util_est's update flag name to better match its usage - slightly clean up cpu_util_wake code - add other small code cleanups as suggested by Peter - fix compilation for !CONFIG_SMP systems - fix documentation to match sphinx syntax - update changelogs to better match code concepts Changes in v5: - rebased on today's tip/sched/core (commit 083c6eeab2cc, based on v4.16-rc2) - update util_est only on util_avg updates - add documentation for "struct util_est" - always use int instead of long whenever possible (Peter) - pass cfs_rq to util_est_{en,de}queue (Peter) - pass task_sleep to util_est_dequeue - use singe WRITE_ONCE at dequeue time - add some missing {READ,WRITE}_ONCE - add task_util_est() for code consistency Changes in v4: - rebased on today's tip/sched/core (commit 460e8c3340a2) - renamed util_est's "last" into "enqueued" - using util_est's "enqueued" for both se and cfs_rqs (Joel) - update margin check to use more ASM friendly code (Peter) - optimize EWMA updates (Peter) - ensure cpu_util_wake() is cpu_capacity_orig()'s clamped (Pavan) - simplify cpu_util_cfs() integration (Dietmar) Changes in v3: - rebased on today's tip/sched/core (commit 07881166a892) - moved util_est into sched_avg (Peter) - use {READ,WRITE}_ONCE() for EWMA updates (Peter) - using unsigned int to fit all sched_avg into a single 64B cache line - schedutil integration using Juri's cpu_util_cfs() - first patch dropped since it's already queued in tip/sched/core Changes in v2: - rebased on top of v4.15-rc2 - tested that overhauled PELT code does not affect the util_est .:: References ============== [1] https://lkml.org/lkml/2018/2/22/639 20180222170153.673-1-patrick.bellasi@arm.com [2] git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core (commit 083c6eeab2cc) [3] https://lkml.org/lkml/2018/1/23/645 20180123180847.4477-1-patrick.bellasi@arm.com Patrick Bellasi (4): sched/fair: add util_est on top of PELT sched/fair: use util_est in LB and WU paths sched/cpufreq_schedutil: use util_est for OPP selection sched/fair: update util_est only on util_avg updates include/linux/sched.h | 29 ++++++ kernel/sched/debug.c | 4 + kernel/sched/fair.c | 237 ++++++++++++++++++++++++++++++++++++++++++++---- kernel/sched/features.h | 5 + kernel/sched/sched.h | 9 +- 5 files changed, 264 insertions(+), 20 deletions(-) -- 2.15.1