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: 8386011 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0C23C9F1D4 for ; Tue, 23 Feb 2016 01:26:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2827720675 for ; Tue, 23 Feb 2016 01:26:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4A7B2047C for ; Tue, 23 Feb 2016 01:26:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932404AbcBWB0B (ORCPT ); Mon, 22 Feb 2016 20:26:01 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33406 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756788AbcBWBWy (ORCPT ); Mon, 22 Feb 2016 20:22:54 -0500 Received: by mail-pa0-f52.google.com with SMTP id fl4so100463943pad.0 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=cIzBiucquhn4nGNc3yj8Ffp4xe5XibZrc27Mws5cfmC27quvC39VoERuwhTMgHck82 8jrkRLf7hsn7nnSW6iLNilNPym+8oY8yIQeZpEqo5H7524WzFtmr5N73W+wQXYbdyJ+i URYAIghbfuO8UKFzOobe9owYk2qw3xbGwhEn3EZ96+ggjvQ8htYNFGcIIwPJZFTXzpXT S14uKqv2DzLP5CSF+uSKF3At/yAcd/i+1iiwY30wWWFV7tS82CJof1xJqeAGgAgkSHvP PtLC+BAF/SF1+9FrKpxI5xhOmGsO2qYnJTx3t6nqzLUPXj9km4bkwyRrlI/mfUIOY0qb 23RQ== X-Gm-Message-State: AG10YOR9johplzQGhYgLE5+SPSkTkDlsM9urAZq9ZZ/PUjtqoductVkJeY4PG2TstJSraYGk 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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