From mboxrd@z Thu Jan 1 00:00:00 1970 From: akpm@linux-foundation.org Subject: [merged] migrate-shutdown-reboot-to-boot-cpu.patch removed from -mm tree Date: Thu, 13 Jun 2013 11:57:25 -0700 Message-ID: <51ba1615.0jqCVKPz7VckDWwC%akpm__26208.2456065857$1371149862$gmane$org@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:37019 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756455Ab3FMS50 (ORCPT ); Thu, 13 Jun 2013 14:57:26 -0400 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org, tglx@linutronix.de, stable@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com, shawn.guo@linaro.org, rja@sgi.com, mingo@elte.hu, linux@arm.linux.org.uk, hpa@zytor.com, gxt@mprc.pku.edu.cn, holt@sgi.com Subject: [merged] migrate-shutdown-reboot-to-boot-cpu.patch removed from -mm tree To: holt@sgi.com,gxt@mprc.pku.edu.cn,hpa@zytor.com,linux@arm.linux.org.uk,mingo@elte.hu,rja@sgi.com,shawn.guo@linaro.org,srivatsa.bhat@linux.vnet.ibm.com,stable@vger.kernel.org,tglx@linutronix.de,mm-commits@vger.kernel.org From: akpm@linux-foundation.org Date: Thu, 13 Jun 2013 11:57:25 -0700 The patch titled Subject: reboot: rigrate shutdown/reboot to boot cpu has been removed from the -mm tree. Its filename was migrate-shutdown-reboot-to-boot-cpu.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Robin Holt Subject: reboot: rigrate shutdown/reboot to boot cpu We recently noticed that reboot of a 1024 cpu machine takes approx 16 minutes of just stopping the cpus. The slowdown was tracked to commit f96972f ("kernel/sys.c: call disable_nonboot_cpus() in kernel_restart()"). The current implementation does all the work of hot removing the cpus before halting the system. We are switching to just migrating to the boot cpu and then continuing with shutdown/reboot. This also has the effect of not breaking x86's command line parameter for specifying the reboot cpu. Note, this code was shamelessly copied from arch/x86/kernel/reboot.c with bits removed pertaining to the reboot_cpu command line parameter. Signed-off-by: Robin Holt Tested-by: Shawn Guo Cc: "Srivatsa S. Bhat" Cc: H. Peter Anvin Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Russ Anderson Cc: Robin Holt Cc: Russell King Cc: Guan Xuetao Cc: Signed-off-by: Andrew Morton --- kernel/sys.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff -puN kernel/sys.c~migrate-shutdown-reboot-to-boot-cpu kernel/sys.c --- a/kernel/sys.c~migrate-shutdown-reboot-to-boot-cpu +++ a/kernel/sys.c @@ -362,6 +362,29 @@ int unregister_reboot_notifier(struct no } EXPORT_SYMBOL(unregister_reboot_notifier); +/* Add backwards compatibility for stable trees. */ +#ifndef PF_NO_SETAFFINITY +#define PF_NO_SETAFFINITY PF_THREAD_BOUND +#endif + +static void migrate_to_reboot_cpu(void) +{ + /* The boot cpu is always logical cpu 0 */ + int cpu = 0; + + cpu_hotplug_disable(); + + /* Make certain the cpu I'm about to reboot on is online */ + if (!cpu_online(cpu)) + cpu = cpumask_first(cpu_online_mask); + + /* Prevent races with other tasks migrating this task */ + current->flags |= PF_NO_SETAFFINITY; + + /* Make certain I only run on the appropriate processor */ + set_cpus_allowed_ptr(current, cpumask_of(cpu)); +} + /** * kernel_restart - reboot the system * @cmd: pointer to buffer containing command to execute for restart @@ -373,7 +396,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier void kernel_restart(char *cmd) { kernel_restart_prepare(cmd); - disable_nonboot_cpus(); + migrate_to_reboot_cpu(); syscore_shutdown(); if (!cmd) printk(KERN_EMERG "Restarting system.\n"); @@ -400,7 +423,7 @@ static void kernel_shutdown_prepare(enum void kernel_halt(void) { kernel_shutdown_prepare(SYSTEM_HALT); - disable_nonboot_cpus(); + migrate_to_reboot_cpu(); syscore_shutdown(); printk(KERN_EMERG "System halted.\n"); kmsg_dump(KMSG_DUMP_HALT); @@ -419,7 +442,7 @@ void kernel_power_off(void) kernel_shutdown_prepare(SYSTEM_POWER_OFF); if (pm_power_off_prepare) pm_power_off_prepare(); - disable_nonboot_cpus(); + migrate_to_reboot_cpu(); syscore_shutdown(); printk(KERN_EMERG "Power down.\n"); kmsg_dump(KMSG_DUMP_POWEROFF); _ Patches currently in -mm which might be from holt@sgi.com are origin.patch dump_stack-serialize-the-output-from-dump_stack.patch dump_stack-serialize-the-output-from-dump_stack-fix.patch panic-add-cpu-pid-to-warn_slowpath_common-in-warning-printks.patch drivers-misc-sgi-gru-grufaultc-fix-a-sanity-test-in-gru_set_context_option.patch reboot-remove-stable-friendly-pf_thread_bound-define.patch reboot-move-shutdown-reboot-related-functions-to-kernel-rebootc.patch reboot-checkpatchpl-the-new-kernel-rebootc-file.patch reboot-x86-prepare-reboot_mode-for-moving-to-generic-kernel-code.patch reboot-unicore32-prepare-reboot_mode-for-moving-to-generic-kernel-code.patch reboot-arm-remove-unused-restart_mode-fields-from-some-arm-subarchs.patch reboot-arm-prepare-reboot_mode-for-moving-to-generic-kernel-code.patch reboot-arm-change-reboot_mode-to-use-enum-reboot_mode.patch reboot-arm-change-reboot_mode-to-use-enum-reboot_mode-fix.patch reboot-move-arch-x86-reboot=-handling-to-generic-kernel.patch