From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933185AbbJIQEU (ORCPT ); Fri, 9 Oct 2015 12:04:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42072 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933124AbbJIQEO (ORCPT ); Fri, 9 Oct 2015 12:04:14 -0400 Date: Fri, 9 Oct 2015 18:00:54 +0200 From: Oleg Nesterov To: Peter Zijlstra Cc: heiko.carstens@de.ibm.com, Tejun Heo , Ingo Molnar , Rik van Riel , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] sched: start stopper early Message-ID: <20151009160054.GA10176@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151009160031.GA5408@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra Ensure the stopper thread is active 'early', because the load balancer pretty much assumes that its available. And when 'online && active' the load-balancer is fully available. Not only the numa balancing stop_two_cpus() caller relies on it, but also the self migration stuff does, and at CPU_ONLINE time the cpu really is 'free' to run anything. Signed-off-by: Oleg Nesterov --- kernel/cpu.c | 1 - kernel/sched/core.c | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index ef52b3b..8a7225a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -464,7 +464,6 @@ static int smpboot_thread_call(struct notifier_block *nfb, switch (action & ~CPU_TASKS_FROZEN) { case CPU_ONLINE: - stop_machine_unpark(cpu); smpboot_unpark_threads(cpu); break; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index e691052..955c181 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5324,11 +5324,14 @@ static void __cpuinit set_cpu_rq_start_time(void) static int sched_cpu_active(struct notifier_block *nfb, unsigned long action, void *hcpu) { + int cpu = (long)hcpu; + switch (action & ~CPU_TASKS_FROZEN) { case CPU_STARTING: set_cpu_rq_start_time(); return NOTIFY_OK; case CPU_ONLINE: + stop_machine_unpark(cpu); /* * At this point a starting CPU has marked itself as online via * set_cpu_online(). But it might not yet have marked itself @@ -5337,7 +5340,7 @@ static int sched_cpu_active(struct notifier_block *nfb, * Thus, fall-through and help the starting CPU along. */ case CPU_DOWN_FAILED: - set_cpu_active((long)hcpu, true); + set_cpu_active(cpu, true); return NOTIFY_OK; default: return NOTIFY_DONE; -- 1.5.5.1