Received: by 10.213.65.68 with SMTP id h4csp258724imn; Tue, 20 Mar 2018 02:48:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELsm9qJW3A2z2tKUJHNLb5vxpCI+TwqOse6lGU/65XDl8Z86BobORetQ4RfP0+CqTXZ9SXux X-Received: by 10.98.178.207 with SMTP id z76mr3595994pfl.37.1521539306716; Tue, 20 Mar 2018 02:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521539306; cv=none; d=google.com; s=arc-20160816; b=b9Gl9ktfDb94QzfLkBmPYQz0QlrEfwARNepXcTtemrk/16qDbNhnP/HIsl4wewSMnN h8pASJ4HveJ+YuWd6i+loam+6R9mS8fiFkpwZGuROgsQqfynv9nz0NSXEs3cGnapwTet Z9LAppnsmnDsRKo5DCcuHij9rTcOgDNYwk9EG9cXYrBkZsvk5S1HcjAmM8cf9DmFjEWb bnQcrMhPujkQUX0zgWoxXjZdJ6uCKXVmoteashRbjxBXgGN3HP+tyby+PGwWv4cIaGRg SOucjY/OonuA4tHdP/fOoChAHq/Gt5TaNlXfGWEARjhMSQmKMU5Zm40Mq1/gX6WSMfoe WyTA== 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=z2eGD7sMS6n2Xu0+PF0ObPLSE0/fOQUVp8lL2WPm55M=; b=fGEJw/gqAFzK+0dusnjArx+2UbT+95KNNaI+uPRVuaNvoKCKQ7KAIOYUDIBRzFounL AO+gfzNSg1hSxCvjWmQGct7rnhoQwXfoaScFMwbSryrb2vG2ywMa/97ViJAU36T4uH7V agIQog3FRoJbwXLRDKtNpq9U/8rTO2PPgxFkwgt/W6fExI/Ex3QcnAANv1VlZsvmq79Y JW7zeiYwQRoWYrD9SOhD6ArcAzo8ZkRFBTAAta4dzFS0wbuGPsU+bJUM5EXJWlP8bH2h wzRQzL1F3Nktz2O3fUXBSDyKg3kaJY+m9AfA66QVkZqkH/dtOk92d6M5jZrv//4VlABl eUJQ== 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 a189si953040pgc.703.2018.03.20.02.48.09; Tue, 20 Mar 2018 02:48:26 -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 S1752695AbeCTJqT (ORCPT + 99 others); Tue, 20 Mar 2018 05:46:19 -0400 Received: from foss.arm.com ([217.140.101.70]:37846 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbeCTJoJ (ORCPT ); Tue, 20 Mar 2018 05:44:09 -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 A8E1915AB; Tue, 20 Mar 2018 02:44:09 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2ED0A3F487; Tue, 20 Mar 2018 02:44:07 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org, Peter Zijlstra , Quentin Perret , Thara Gopinath Cc: linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes Subject: [RFC PATCH 1/6] sched/fair: Create util_fits_capacity() Date: Tue, 20 Mar 2018 09:43:07 +0000 Message-Id: <20180320094312.24081-2-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180320094312.24081-1-dietmar.eggemann@arm.com> References: <20180320094312.24081-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The functionality that a given utilization fits into a given capacity is factored out into a separate function. Currently it is only used in wake_cap() but will be re-used to figure out if a cpu or a scheduler group is over-utilized. Cc: Ingo Molnar Cc: Peter Zijlstra Signed-off-by: Dietmar Eggemann --- kernel/sched/fair.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3582117e1580..bf7b485ddf60 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6374,6 +6374,11 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) return (util >= capacity) ? capacity : util; } +static inline int util_fits_capacity(unsigned long util, unsigned long capacity) +{ + return capacity * 1024 > util * capacity_margin; +} + /* * Disable WAKE_AFFINE in the case where task @p doesn't fit in the * capacity of either the waking CPU @cpu or the previous CPU @prev_cpu. @@ -6395,7 +6400,7 @@ static int wake_cap(struct task_struct *p, int cpu, int prev_cpu) /* Bring task utilization in sync with prev_cpu */ sync_entity_load_avg(&p->se); - return min_cap * 1024 < task_util(p) * capacity_margin; + return !util_fits_capacity(task_util(p), min_cap); } /* -- 2.11.0