From patchwork Wed Jul 5 08:59:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juri Lelli X-Patchwork-Id: 107050 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp566262obb; Wed, 5 Jul 2017 02:00:58 -0700 (PDT) X-Received: by 10.84.217.30 with SMTP id o30mr21222490pli.184.1499245258782; Wed, 05 Jul 2017 02:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499245258; cv=none; d=google.com; s=arc-20160816; b=Frek+eg4bbexXaQYbe6f5ficdDnIla4yCi0Wp18i12YRvlaBNZfSQv3bPMoAOYKYI+ K9Mr4cDOAHUY8jLDYY7/PV66kikh5McJhfD/14jn8M20XyMzbzFeb5X15hPTc3OoU2WX Tz0p4zI5Zu1XeXD7iaN21SQaZC/vXCrOa9g7AWqLguj0qr2fG1d+NU1vxGznCxbpj9zF 367iIwNS03lZKCQ2avsWnN6vFmF7d/m38KTcif/MVukvCBQMW3sE9ZDtqwH/PmLs/SiJ 6R2TcppuvUFzIMSocTJfo4od2YVGClxL+2JMdGOPVLh57WBvCxptZbSTKZe4hT+/8DuS is2Q== 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=/WxLeoqWiuk45TQpAVrbg+ndKqs6QweLBPq1LMxcK94=; b=E/csAjO82Y8fiq8H5NqmM8OuG0z7KrgLCCo2z98t0HcSFph3Xqa24ORZ5diVKteUaU nUbhV8Z/Mk4QSjLqGuH/QdAfL7HoAEhYdwgseeP2heM0xbCglxs26tGc5esv1fLQLRP0 dFoaTAmJkQ2UC8Kjnmq2jVXm99y3/djIaHeEXDKJ31ApUWzj41NWtJzrLH/GiTFKDizK F+IUtBuVYZ4g8NN0j5IhEo7g2XAKeerQIR5sVg2HY1XTSkfW3I/5KDpvE9hjXxR3y4Hq xo+hF5SiM68utyckF9HdEt8i0kGwy0VyawrR2nH3xsM8h08EROwdpoUR7sZMbo1LlOuU wbVA== 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 o29si10018563pgn.537.2017.07.05.02.00.58; Wed, 05 Jul 2017 02:00:58 -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 S1752681AbdGEJAv (ORCPT + 25 others); Wed, 5 Jul 2017 05:00:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53648 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbdGEJAt (ORCPT ); Wed, 5 Jul 2017 05:00:49 -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 8612880D; Wed, 5 Jul 2017 02:00:38 -0700 (PDT) Received: from cam-smtp0.cambridge.arm.com (e106622-lin.cambridge.arm.com [10.1.211.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4AC933F581; Wed, 5 Jul 2017 02:00:35 -0700 (PDT) From: Juri Lelli To: peterz@infradead.org, mingo@redhat.com, rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, tglx@linutronix.de, vincent.guittot@linaro.org, rostedt@goodmis.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, tkjos@android.com, joelaf@google.com, andresoportus@google.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, patrick.bellasi@arm.com, juri.lelli@arm.com, Ingo Molnar Subject: [RFC PATCH v1 7/8] sched/sched.h: move arch_scale_{freq, cpu}_capacity outside CONFIG_SMP Date: Wed, 5 Jul 2017 09:59:04 +0100 Message-Id: <20170705085905.6558-8-juri.lelli@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170705085905.6558-1-juri.lelli@arm.com> References: <20170705085905.6558-1-juri.lelli@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, frequency and cpu capacity scaling is only performed on CONFIG_SMP systems (as CFS PELT signals are only present for such systems). However, other scheduling classes want to do freq/cpu scaling, and for !CONFIG_SMP configurations as well. arch_scale_freq_capacity is useful to implement frequency scaling even on !CONFIG_SMP platforms, so we simply move it outside CONFIG_SMP ifdeffery. Even if arch_scale_cpu_capacity is not useful on !CONFIG_SMP platforms, we make a default implementation available for such configurations anyway to simplify scheduler code doing CPU scale invariance. Signed-off-by: Juri Lelli Cc: Peter Zijlstra Cc: Ingo Molnar --- include/linux/sched/topology.h | 12 ++++++------ kernel/sched/sched.h | 13 ++++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) -- 2.11.0 diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 7d065abc7a47..953cf4f889ec 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -6,6 +6,12 @@ #include /* + * Increase resolution of cpu_capacity calculations + */ +#define SCHED_CAPACITY_SHIFT SCHED_FIXEDPOINT_SHIFT +#define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT) + +/* * sched-domains (multiprocessor balancing) declarations: */ #ifdef CONFIG_SMP @@ -26,12 +32,6 @@ #define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ #define SD_NUMA 0x4000 /* cross-node balancing */ -/* - * Increase resolution of cpu_capacity calculations - */ -#define SCHED_CAPACITY_SHIFT SCHED_FIXEDPOINT_SHIFT -#define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT) - #ifdef CONFIG_SCHED_SMT static inline int cpu_smt_flags(void) { diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ec5769288927..178f4a5df2fa 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1668,9 +1668,6 @@ static inline int hrtick_enabled(struct rq *rq) #endif /* CONFIG_SCHED_HRTICK */ -#ifdef CONFIG_SMP -extern void sched_avg_update(struct rq *rq); - #ifndef arch_scale_freq_capacity static __always_inline unsigned long arch_scale_freq_capacity(int cpu) @@ -1679,6 +1676,9 @@ unsigned long arch_scale_freq_capacity(int cpu) } #endif +#ifdef CONFIG_SMP +extern void sched_avg_update(struct rq *rq); + #ifndef arch_scale_cpu_capacity static __always_inline unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) @@ -1696,6 +1696,13 @@ static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) sched_avg_update(rq); } #else +#ifndef arch_scale_cpu_capacity +static __always_inline +unsigned long arch_scale_cpu_capacity(void __always_unused *sd, int cpu) +{ + return SCHED_CAPACITY_SCALE; +} +#endif static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) { } static inline void sched_avg_update(struct rq *rq) { } #endif