From patchwork Tue Feb 23 01:22:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Muckle X-Patchwork-Id: 62652 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1569083lbl; Mon, 22 Feb 2016 17:26:09 -0800 (PST) X-Received: by 10.67.6.72 with SMTP id cs8mr42182223pad.138.1456190769503; Mon, 22 Feb 2016 17:26:09 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si43385044pfj.30.2016.02.22.17.26.07; Mon, 22 Feb 2016 17:26:09 -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; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756772AbcBWB0D (ORCPT + 30 others); Mon, 22 Feb 2016 20:26:03 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36110 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756787AbcBWBWy (ORCPT ); Mon, 22 Feb 2016 20:22:54 -0500 Received: by mail-pa0-f51.google.com with SMTP id yy13so100320419pab.3 for ; Mon, 22 Feb 2016 17:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n/tltwf4x33sMpqwsS3hcnx8e2WAtk6+SXXHwHXIG/o=; b=gLVujhpdof8RptB3GdBGSRe0EAtBdRtTwWguEe2F0yADON8MNgjLDu+pyeP08vz9yb /ZWPAHxbTjPOkzmZJc8QEl1aR/Xfr53ROyvJc/dpBRE4RsXeht5HlQzOi97vhfLM08A7 asifM5oV1mI0ySsXuHjVsvYC6n4rsByu4E+QE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n/tltwf4x33sMpqwsS3hcnx8e2WAtk6+SXXHwHXIG/o=; b=Ozi0cdeX3tt+YLZXwcJLkGhc18hzX2xZA9TuZtZVMJpnhiKXQainOcpqUaSP245hE7 p9trh8jIixynQWM+qiz4JyFgiXcroTdM1Xx5OIyu8ByFCFVp/G3wuQ2iad3EjZKmN2+J gZyvClGerk8IDy/vrAEfUDSBiWkZlFmP+S20wRpvqTCTpRng4Z3ZqfJdERL1GSzd4UOK rAM9Y4/VU13P/kQhx9JMRbw41nCCITQncMTMWsPySRzbnz9x61GWIy7Hk/QhUkTKVIRf G5/TtFmyYarpgNHsPBfH01zQiL+miGlBZdVPmX0AQfbL6kVJ36bawPMJ8EPN484X79V4 lyTw== X-Gm-Message-State: AG10YOQ4jFIa24eYEQ4FzWwtMQuA7Bro945+9ELa5n/qvzKhI1u54MXri+v0O7jmwY+LvBmQ X-Received: by 10.66.249.41 with SMTP id yr9mr42476000pac.86.1456190574193; Mon, 22 Feb 2016 17:22:54 -0800 (PST) Received: from graphite.smuckle.net (cpe-75-80-155-7.san.res.rr.com. [75.80.155.7]) by smtp.gmail.com with ESMTPSA id t29sm39626789pfi.8.2016.02.22.17.22.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 17:22:53 -0800 (PST) From: Steve Muckle X-Google-Original-From: Steve Muckle To: Peter Zijlstra , Ingo Molnar , "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette Subject: [RFCv7 PATCH 01/10] sched: Compute cpu capacity available at current frequency Date: Mon, 22 Feb 2016 17:22:41 -0800 Message-Id: <1456190570-4475-2-git-send-email-smuckle@linaro.org> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1456190570-4475-1-git-send-email-smuckle@linaro.org> References: <1456190570-4475-1-git-send-email-smuckle@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Morten Rasmussen capacity_orig_of() returns the max available compute capacity of a cpu. For scale-invariant utilization tracking and energy-aware scheduling decisions it is useful to know the compute capacity available at the current OPP of a cpu. cc: Ingo Molnar cc: Peter Zijlstra Signed-off-by: Morten Rasmussen Signed-off-by: Steve Muckle --- kernel/sched/fair.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.4.10 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7ce24a4..3437e01 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4821,6 +4821,17 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg) #endif /* + * Returns the current capacity of cpu after applying both + * cpu and freq scaling. + */ +static unsigned long capacity_curr_of(int cpu) +{ + return cpu_rq(cpu)->cpu_capacity_orig * + arch_scale_freq_capacity(NULL, cpu) + >> SCHED_CAPACITY_SHIFT; +} + +/* * Detect M:N waker/wakee relationships via a switching-frequency heuristic. * A waker of many should wake a different task than the one last awakened * at a frequency roughly N times higher than one of its wakees. In order