Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3709037imu; Sun, 11 Nov 2018 22:04:28 -0800 (PST) X-Google-Smtp-Source: AJdET5cttRDWS43vVVTN+MAMmJw4ZqJxZS7eAvge6ibSWMJXxSAYoGS9+4Yu0URKl+Oi94hHR7cA X-Received: by 2002:a17:902:bc8c:: with SMTP id bb12-v6mr17934149plb.275.1542002668934; Sun, 11 Nov 2018 22:04:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542002668; cv=none; d=google.com; s=arc-20160816; b=v6xOM3NWFmzpth18plyapbZvFwSNBg25B8tAkGCAafeglzT+Au+1Fe1OoEa5AOW2Xt fs+z3f2qUDyntLpf1v8dmB2DybP+CzPmS0xE2D+yzR1b9lwJQPZHed8iJP2Vazq5vw1I wfJeMRJDzJDqaoFKd1pzqtKXEGPNHCx8NtV0+zN6x9SCg5rv3nTM8l8QJ4h9qs8Ehn8L 8COCLQOkp2q4Wkw9vyBuB7AoHn+Lxrz5ipD8pfqQGq9cNqVowj0Y/TEloYcbQGcO0fks 0eDoB976LOhiwTbpcx791gdPR/STa/Hzs6NmhKQ9qwY6hbgYzWj7Y5YQoG/TutConfhc ivFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=zchA9R5Mr3U0czCfGwnH04u6LqedFHqZ6n+om9AvNSU=; b=IxlRv66VJqlFJF05B1kE7tJiuYeMew/zGZB9nT8577Ez99nE3QP6lNdAe94Cv7nlAy TlZs4Ch9vaujbn6BXBackbJ10itYsTsfPEeYX5cIpQoaewWcUTT0AkaOinjLWH3cH4t6 o9MAlszeVg9rljzkEEjcDWNaZ+xVxhOIkAD6KJR9V7Knm2vvuzfC8QU3UtH8goT06agr 47sHdaQTwykSfyNQ7JfK/f3nFXsWh3x9SBc5gRYQnWdkJeBQ5S7TQvsE0DEIk3QrhbqS EYPeeJcOAJnuyECInRouDTOgCQAT9lI1dgoqtR209xaBSbXsyfF1fCu+Czc/Ka79xoFA MqXA== 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 h69si14327392pge.121.2018.11.11.22.04.13; Sun, 11 Nov 2018 22:04:28 -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 S1731713AbeKLPzi (ORCPT + 99 others); Mon, 12 Nov 2018 10:55:38 -0500 Received: from terminus.zytor.com ([198.137.202.136]:39747 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731226AbeKLPzi (ORCPT ); Mon, 12 Nov 2018 10:55:38 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wAC63Lkf3546957 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 11 Nov 2018 22:03:21 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wAC63K493546951; Sun, 11 Nov 2018 22:03:20 -0800 Date: Sun, 11 Nov 2018 22:03:20 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Patrick Bellasi Message-ID: Cc: dietmar.eggemann@arm.com, tkjos@google.com, juri.lelli@redhat.com, morten.rasmussen@arm.com, tglx@linutronix.de, patrick.bellasi@arm.com, mingo@kernel.org, surenb@google.com, smuckle@google.com, vincent.guittot@linaro.org, quentin.perret@arm.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, peterz@infradead.org, hpa@zytor.com Reply-To: smuckle@google.com, vincent.guittot@linaro.org, quentin.perret@arm.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, dietmar.eggemann@arm.com, tkjos@google.com, juri.lelli@redhat.com, morten.rasmussen@arm.com, patrick.bellasi@arm.com, tglx@linutronix.de, surenb@google.com, mingo@kernel.org In-Reply-To: <20181105145400.935-3-patrick.bellasi@arm.com> References: <20181105145400.935-3-patrick.bellasi@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Mask UTIL_AVG_UNCHANGED usages Git-Commit-ID: 92a801e5d5b7a893881c1676b15dd246727ccd16 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 92a801e5d5b7a893881c1676b15dd246727ccd16 Gitweb: https://git.kernel.org/tip/92a801e5d5b7a893881c1676b15dd246727ccd16 Author: Patrick Bellasi AuthorDate: Mon, 5 Nov 2018 14:53:59 +0000 Committer: Ingo Molnar CommitDate: Mon, 12 Nov 2018 06:17:52 +0100 sched/fair: Mask UTIL_AVG_UNCHANGED usages The _task_util_est() is mainly used to add/remove the task contribution to/from the rq's estimated utilization at task enqueue/dequeue time. In both cases we ensure the UTIL_AVG_UNCHANGED flag is set to keep consistency between enqueue and dequeue time while still being transparent to update_load_avg calls which will eventually reset the flag. Let's move the flag forcing within _task_util_est() itself so that we can simplify calling code by hiding that estimated utilization implementation detail into one of its internal functions. This will affect also the "public" API task_util_est() but we know that the flag will (eventually) impact just on the LSB of the estimated utilization, thus it's certainly acceptable. Signed-off-by: Patrick Bellasi Signed-off-by: Peter Zijlstra (Intel) Cc: Dietmar Eggemann Cc: Juri Lelli Cc: Linus Torvalds Cc: Morten Rasmussen Cc: Peter Zijlstra Cc: Quentin Perret Cc: Steve Muckle Cc: Suren Baghdasaryan Cc: Thomas Gleixner Cc: Todd Kjos Cc: Vincent Guittot Link: http://lkml.kernel.org/r/20181105145400.935-3-patrick.bellasi@arm.com Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a1ccf1ddd37a..28ee60cabba1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3604,7 +3604,7 @@ static inline unsigned long _task_util_est(struct task_struct *p) { struct util_est ue = READ_ONCE(p->se.avg.util_est); - return max(ue.ewma, ue.enqueued); + return (max(ue.ewma, ue.enqueued) | UTIL_AVG_UNCHANGED); } static inline unsigned long task_util_est(struct task_struct *p) @@ -3622,7 +3622,7 @@ static inline void util_est_enqueue(struct cfs_rq *cfs_rq, /* Update root cfs_rq's estimated utilization */ enqueued = cfs_rq->avg.util_est.enqueued; - enqueued += (_task_util_est(p) | UTIL_AVG_UNCHANGED); + enqueued += _task_util_est(p); WRITE_ONCE(cfs_rq->avg.util_est.enqueued, enqueued); } @@ -3650,8 +3650,7 @@ util_est_dequeue(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep) /* Update root cfs_rq's estimated utilization */ ue.enqueued = cfs_rq->avg.util_est.enqueued; - ue.enqueued -= min_t(unsigned int, ue.enqueued, - (_task_util_est(p) | UTIL_AVG_UNCHANGED)); + ue.enqueued -= min_t(unsigned int, ue.enqueued, _task_util_est(p)); WRITE_ONCE(cfs_rq->avg.util_est.enqueued, ue.enqueued); /* @@ -6292,7 +6291,7 @@ static unsigned long cpu_util_without(int cpu, struct task_struct *p) */ if (unlikely(task_on_rq_queued(p) || current == p)) { estimated -= min_t(unsigned int, estimated, - (_task_util_est(p) | UTIL_AVG_UNCHANGED)); + _task_util_est(p)); } util = max(util, estimated); }