Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758329AbcJTJeK (ORCPT ); Thu, 20 Oct 2016 05:34:10 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35986 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751044AbcJTJeI (ORCPT ); Thu, 20 Oct 2016 05:34:08 -0400 Message-ID: <1476956043.18007.15.camel@gmail.com> Subject: [rfc patch] hotplug: Call mmdrop_delayed() in sched_cpu_dying() if PREEMPT_RT_FULL From: Mike Galbraith To: Sebastian Andrzej Siewior , Thomas Gleixner Cc: LKML , linux-rt-users , Steven Rostedt Date: Thu, 20 Oct 2016 11:34:03 +0200 In-Reply-To: <20161006085228.jl6rpszdp5c2p2nr@linutronix.de> References: <20161006085228.jl6rpszdp5c2p2nr@linutronix.de> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3189 Lines: 58 My 64 core box just passed an hour running Steven's hotplug stress script along with stockfish and futextests (tip-rt.today w. hotplug hacks you saw a while back), and seems content to just keep on grinding away. Without it, box quickly becomes a doorstop. [ 634.896901] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:931 [ 634.896902] in_atomic(): 1, irqs_disabled(): 1, pid: 104, name: migration/6 [ 634.896902] no locks held by migration/6/104. [ 634.896903] irq event stamp: 1208518 [ 634.896907] hardirqs last enabled at (1208517): [] _raw_spin_unlock_irqrestore+0x8c/0xa0 [ 634.896910] hardirqs last disabled at (1208518): [] multi_cpu_stop+0xc5/0x110 [ 634.896912] softirqs last enabled at (0): [] copy_process.part.32+0x672/0x1fc0 [ 634.896913] softirqs last disabled at (0): [< (null)>] (null) [ 634.896914] Preemption disabled at:[] cpu_stopper_thread+0x8c/0x120 [ 634.896914] [ 634.896915] CPU: 6 PID: 104 Comm: migration/6 Tainted: G E 4.8.2-rt1-rt_debug #23 [ 634.896916] Hardware name: MEDION MS-7848/MS-7848, BIOS M7848W08.20C 09/23/2013 [ 634.896918] 0000000000000000 ffff880176fb3c40 ffffffff8139c04d 0000000000000000 [ 634.896919] ffff880176fa8000 ffff880176fb3c68 ffffffff810a8102 ffffffff81c29cc0 [ 634.896919] ffff8803fc825640 ffff8803fc825640 ffff880176fb3c88 ffffffff816de754 [ 634.896920] Call Trace: [ 634.896923] [] dump_stack+0x85/0xc8 [ 634.896924] [] ___might_sleep+0x152/0x250 [ 634.896926] [] rt_spin_lock+0x24/0x80 [ 634.896928] [] ? __lock_is_held+0x49/0x70 [ 634.896929] [] pgd_free+0x1e/0xb0 [ 634.896930] [] __mmdrop+0x27/0xd0 [ 634.896932] [] sched_cpu_dying+0x24d/0x2c0 [ 634.896933] [] ? sched_cpu_starting+0x60/0x60 [ 634.896934] [] cpuhp_invoke_callback+0xd4/0x350 [ 634.896935] [] take_cpu_down+0x86/0xd0 [ 634.896936] [] multi_cpu_stop+0xd0/0x110 [ 634.896937] [] ? cpu_stop_queue_work+0x90/0x90 [ 634.896938] [] cpu_stopper_thread+0x92/0x120 [ 634.896940] [] smpboot_thread_fn+0x1de/0x360 [ 634.896941] [] ? smpboot_update_cpumask_percpu_thread+0x130/0x130 [ 634.896942] [] kthread+0xef/0x110 [ 634.896944] [] ret_from_fork+0x1f/0x40 [ 634.896945] [] ? kthread_park+0x60/0x60 [ 634.896970] smpboot: CPU 6 is now offline Signed-off-by: Mike Galbraith --- kernel/sched/core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7569,6 +7569,9 @@ int sched_cpu_dying(unsigned int cpu) nohz_balance_exit_idle(cpu); hrtick_clear(rq); if (per_cpu(idle_last_mm, cpu)) { + if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL)) + mmdrop_delayed(per_cpu(idle_last_mm, cpu)); + else mmdrop(per_cpu(idle_last_mm, cpu)); per_cpu(idle_last_mm, cpu) = NULL; }