From patchwork Mon Nov 14 12:38:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 5098 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 2E39D23E01 for ; Mon, 14 Nov 2011 12:38:48 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 22C59A180F0 for ; Mon, 14 Nov 2011 12:38:48 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id a26so395605faa.11 for ; Mon, 14 Nov 2011 04:38:48 -0800 (PST) Received: by 10.152.105.226 with SMTP id gp2mr13834077lab.28.1321274327972; Mon, 14 Nov 2011 04:38:47 -0800 (PST) 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.40.7 with SMTP id t7cs37777lak; Mon, 14 Nov 2011 04:38:47 -0800 (PST) Received: by 10.181.13.84 with SMTP id ew20mr24998591wid.58.1321274326314; Mon, 14 Nov 2011 04:38:46 -0800 (PST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id ge20si4976326wbb.76.2011.11.14.04.38.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Nov 2011 04:38:46 -0800 (PST) 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 wyh13 with SMTP id 13so1347236wyh.37 for ; Mon, 14 Nov 2011 04:38:45 -0800 (PST) Received: by 10.180.75.204 with SMTP id e12mr24928138wiw.61.1321274325726; Mon, 14 Nov 2011 04:38:45 -0800 (PST) Received: from localhost.localdomain (pas72-1-88-161-60-229.fbx.proxad.net. [88.161.60.229]) by mx.google.com with ESMTPS id k5sm12195259wiz.9.2011.11.14.04.38.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Nov 2011 04:38:44 -0800 (PST) From: Vincent Guittot To: linaro-dev@lists.linaro.org Cc: patches@linaro.org, Vincent Guittot Subject: [RFC PATCH v2 04/09] ARM: scheduler: add a cpu_power function Date: Mon, 14 Nov 2011 13:38:34 +0100 Message-Id: <1321274314-2318-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 af1c3e6..9d80e22 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -45,12 +45,32 @@ struct cputopo_arm cpu_topology[NR_CPUS]; /* + * 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); + +/* * cpu topology mask management */ unsigned int advanced_topology = 1; /* + * 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 */ @@ -281,6 +301,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(); }