From patchwork Fri Oct 21 16:55:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 4783 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C98F423DEF for ; Fri, 21 Oct 2011 16:55:51 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id BDBCAA182E2 for ; Fri, 21 Oct 2011 16:55:51 +0000 (UTC) Received: by eyg5 with SMTP id 5so5273677eyg.11 for ; Fri, 21 Oct 2011 09:55:51 -0700 (PDT) Received: by 10.223.91.143 with SMTP id n15mr20537431fam.23.1319216151508; Fri, 21 Oct 2011 09:55:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.1.71 with SMTP id 7cs22875lak; Fri, 21 Oct 2011 09:55:51 -0700 (PDT) Received: by 10.216.136.3 with SMTP id v3mr10780088wei.39.1319216150930; Fri, 21 Oct 2011 09:55:50 -0700 (PDT) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id z32si10148972weq.133.2011.10.21.09.55.50 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Oct 2011 09:55:50 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) smtp.mail=vincent.guittot@linaro.org Received: by mail-wy0-f178.google.com with SMTP id 28so4817080wyf.37 for ; Fri, 21 Oct 2011 09:55:50 -0700 (PDT) Received: by 10.216.134.80 with SMTP id r58mr400519wei.63.1319216150362; Fri, 21 Oct 2011 09:55:50 -0700 (PDT) Received: from localhost.localdomain (pas72-1-88-161-60-229.fbx.proxad.net. [88.161.60.229]) by mx.google.com with ESMTPS id i21sm19143730wbn.8.2011.10.21.09.55.49 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Oct 2011 09:55:49 -0700 (PDT) From: Vincent Guittot To: linaro-dev@lists.linaro.org Cc: patches@linaro.org, Vincent Guittot Subject: [RFC PATCH 05/11] ARM: scheduler: add a cpu_power function Date: Fri, 21 Oct 2011 18:55:35 +0200 Message-Id: <1319216135-2561-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.4.1 Add an architecture specific function for setting cpu_power Signed-off-by: Vincent Guittot --- arch/arm/kernel/topology.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index faf66f3..974177d 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -52,6 +52,26 @@ static void default_cpu_topology_mask(void); static void (*set_cpu_topology_mask)(void) = default_cpu_topology_mask; /* + * cpu power scale management + */ + +/* + * a per cpu data structure should be better because each cpu is mainly + * using its own cpu_power even it's not always true because of + * no_hz_idle_balance + */ +static DEFINE_PER_CPU(unsigned int, cpu_scale); + +/* + * Update the cpu power + */ + +unsigned long arch_scale_freq_power(struct sched_domain *sd, int cpu) +{ + return per_cpu(cpu_scale, cpu); +} + +/* * default topology function */ @@ -271,6 +291,8 @@ void init_cpu_topology(void) cpu_topo->socket_id = -1; cpumask_clear(&cpu_topo->core_sibling); cpumask_clear(&cpu_topo->thread_sibling); + + per_cpu(cpu_scale, cpu) = SCHED_POWER_SCALE; } smp_wmb(); }