From patchwork Mon May 29 21:02:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 100684 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp497961qge; Mon, 29 May 2017 14:18:39 -0700 (PDT) X-Received: by 10.98.147.199 with SMTP id r68mr19840026pfk.168.1496092719749; Mon, 29 May 2017 14:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496092719; cv=none; d=google.com; s=arc-20160816; b=Hew8A9Xt8JSZcJtxdU3f+uLfFMmdIp0HkEQU2xdTmVqpt09/9Qel0NwigDvRG4aNuO 9ZQ46FKagy7idgoKLhwAe17DdVku8VxwoawjV/mwluao/fAzNE4kae4Q5Q61Dz6eiCta eElfcFewmCncNSVookWf8RV8tb0R+h4t+vSNIL+wo4McHPLzVyb6/WidxWP48OmSIAGe AN/wKw2wHQGgGY8n/6E70ByriGt9Mb5OUhwO34DdzDWn+YiSIpw8tJyGPcLVVfotUKFc TJQ+DqYTcpYadtRx6O2KxEIZWLVFxJti0qudzyXjFIWBp/0lcdUSbcWBLfHfOF1jKHDX javw== 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=sdYroL4SumkGv/NuUHBFaluA/unPWkmy88pbdqugAm8=; b=kvJVRcPk/FL8OrUZ0JnhsdgDAOABDOzh7gLQHML2iU7VdOI0vpA1dRII/YpyhN3w0g 2wcyji8GFAfR3WMJGgrYZ95grThRuKzKYmHM6PSoAgEeCtrNqlboQOKj2iO0HByZM1QS XUGkN0ESzTuANuJGjHc333ghBzQonY1UY+nX0nl8llY54fAkW4OpmqvpxCzb6Jv+83c0 IUxvwWlNQ8/8W7mYtt6Goo9NvkoMHjuyaUTmXM0fIojmk9yGPQqptACHqMWEcifXbJfG ZOwDazzWP93gdZsKuUDm88kJwWkCbN8dqrrtdWdweXKGJkIazLbq3RfvP7yx3FsM4SyI eSBg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c75si11400563pfe.281.2017.05.29.14.18.39; Mon, 29 May 2017 14:18:39 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751262AbdE2VSP (ORCPT + 25 others); Mon, 29 May 2017 17:18:15 -0400 Received: from alt42.smtp-out.videotron.ca ([23.233.128.29]:25847 "EHLO alt42.smtp-out.videotron.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbdE2VSJ (ORCPT ); Mon, 29 May 2017 17:18:09 -0400 X-Greylist: delayed 900 seconds by postgrey-1.27 at vger.kernel.org; Mon, 29 May 2017 17:18:09 EDT Received: from yoda.home ([96.23.157.65]) by Videotron with SMTP id FRohdqCgAcMN9FRoidPgIU; Mon, 29 May 2017 17:03:09 -0400 X-Authority-Analysis: v=2.1 cv=YqOvP9sX c=1 sm=1 tr=0 a=keA3yYpnlypCNW5BNWqu+w==:117 a=keA3yYpnlypCNW5BNWqu+w==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=tJ8p9aeEuA8A:10 a=KKAkSRfTAAAA:8 a=B9Y0AwaOc7kCs6NPOrwA:9 a=FdOpKekb0-IRxDa2:21 a=aQQ4gQ2imCHPmnEh:21 a=cvBusfyB2V15izCimMoJ:22 Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 988AF2DA05A9; Mon, 29 May 2017 17:03:07 -0400 (EDT) From: Nicolas Pitre To: Ingo Molnar , Peter Zijlstra Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/7] sched: omit stop_sched_class when !SMP Date: Mon, 29 May 2017 17:02:57 -0400 Message-Id: <20170529210302.26868-3-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170529210302.26868-1-nicolas.pitre@linaro.org> References: <20170529210302.26868-1-nicolas.pitre@linaro.org> X-CMAE-Envelope: MS4wfMBXl08pu8i2NoJpvsuSlyQeOToQuGYwD+YLfqm6Agim4yBUMGVPScJrI8QtBY2vseiED28kpE5++wNLqeIqAS76LKrxNWXcikWBwyYD6B/uRYLDP2e0 bLAxNLrojehjUvaWHjm00atcOq6XjXqxD5TDf5USh16rjud0IIPl+V1Qrm+A2z3jZgHGviUAFHWOGvrMfzya440XQVa5ZgQ+LCN3ixvA3xJY0vKN73pbKTMD Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The stop class is invoked through stop_machine only. This is dead code on UP builds. Signed-off-by: Nicolas Pitre --- kernel/sched/Makefile | 4 ++-- kernel/sched/core.c | 60 +++++++++++++++++++++++++-------------------------- kernel/sched/sched.h | 4 ++++ 3 files changed, 36 insertions(+), 32 deletions(-) -- 2.9.4 diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile index 89ab675866..5e4c2e7a63 100644 --- a/kernel/sched/Makefile +++ b/kernel/sched/Makefile @@ -16,9 +16,9 @@ CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer endif obj-y += core.o loadavg.o clock.o cputime.o -obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o +obj-y += idle_task.o fair.o rt.o deadline.o obj-y += wait.o swait.o completion.o idle.o -obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o +obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o stop_task.o obj-$(CONFIG_SCHED_AUTOGROUP) += autogroup.o obj-$(CONFIG_SCHEDSTATS) += stats.o obj-$(CONFIG_SCHED_DEBUG) += debug.o diff --git a/kernel/sched/core.c b/kernel/sched/core.c index de274b1bd2..94fa712791 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -788,36 +788,6 @@ void deactivate_task(struct rq *rq, struct task_struct *p, int flags) dequeue_task(rq, p, flags); } -void sched_set_stop_task(int cpu, struct task_struct *stop) -{ - struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 }; - struct task_struct *old_stop = cpu_rq(cpu)->stop; - - if (stop) { - /* - * Make it appear like a SCHED_FIFO task, its something - * userspace knows about and won't get confused about. - * - * Also, it will make PI more or less work without too - * much confusion -- but then, stop work should not - * rely on PI working anyway. - */ - sched_setscheduler_nocheck(stop, SCHED_FIFO, ¶m); - - stop->sched_class = &stop_sched_class; - } - - cpu_rq(cpu)->stop = stop; - - if (old_stop) { - /* - * Reset it back to a normal scheduling class so that - * it can die in pieces. - */ - old_stop->sched_class = &rt_sched_class; - } -} - /* * __normal_prio - return the priority that is based on the static prio */ @@ -1588,6 +1558,36 @@ static void update_avg(u64 *avg, u64 sample) *avg += diff >> 3; } +void sched_set_stop_task(int cpu, struct task_struct *stop) +{ + struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 }; + struct task_struct *old_stop = cpu_rq(cpu)->stop; + + if (stop) { + /* + * Make it appear like a SCHED_FIFO task, its something + * userspace knows about and won't get confused about. + * + * Also, it will make PI more or less work without too + * much confusion -- but then, stop work should not + * rely on PI working anyway. + */ + sched_setscheduler_nocheck(stop, SCHED_FIFO, ¶m); + + stop->sched_class = &stop_sched_class; + } + + cpu_rq(cpu)->stop = stop; + + if (old_stop) { + /* + * Reset it back to a normal scheduling class so that + * it can die in pieces. + */ + old_stop->sched_class = &rt_sched_class; + } +} + #else static inline int __set_cpus_allowed_ptr(struct task_struct *p, diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 6dda2aab73..053f60afb7 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1422,7 +1422,11 @@ static inline void set_curr_task(struct rq *rq, struct task_struct *curr) curr->sched_class->set_curr_task(rq); } +#ifdef CONFIG_SMP #define sched_class_highest (&stop_sched_class) +#else +#define sched_class_highest (&dl_sched_class) +#endif #define for_each_class(class) \ for (class = sched_class_highest; class; class = class->next)