From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031026Ab2CUN7q (ORCPT ); Wed, 21 Mar 2012 09:59:46 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:61813 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030946Ab2CUN7m (ORCPT ); Wed, 21 Mar 2012 09:59:42 -0400 From: Frederic Weisbecker To: LKML , linaro-sched-sig@lists.linaro.org Cc: Frederic Weisbecker , Alessio Igor Bogani , Andrew Morton , Avi Kivity , Chris Metcalf , Christoph Lameter , Daniel Lezcano , Geoff Levand , Gilad Ben Yossef , Ingo Molnar , Max Krasnyansky , "Paul E. McKenney" , Peter Zijlstra , Stephen Hemminger , Steven Rostedt , Sven-Thorsten Dietrich , Thomas Gleixner , Zen Lin Subject: [PATCH 15/32] nohz/cpuset: Restart the tick if printk needs it Date: Wed, 21 Mar 2012 14:58:21 +0100 Message-Id: <1332338318-5958-17-git-send-email-fweisbec@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1332338318-5958-1-git-send-email-fweisbec@gmail.com> References: <1332338318-5958-1-git-send-email-fweisbec@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we are in nohz adaptive mode and printk is called, the tick is missing to wake up the logger. We need to restart the tick when that happens. Do this asynchronously by issuing a tick restart self IPI to avoid deadlocking with the current random locking chain. Signed-off-by: Frederic Weisbecker Cc: Alessio Igor Bogani Cc: Andrew Morton Cc: Avi Kivity Cc: Chris Metcalf Cc: Christoph Lameter Cc: Daniel Lezcano Cc: Geoff Levand Cc: Gilad Ben Yossef Cc: Ingo Molnar Cc: Max Krasnyansky Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Stephen Hemminger Cc: Steven Rostedt Cc: Sven-Thorsten Dietrich Cc: Thomas Gleixner Cc: Zen Lin --- kernel/printk.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/kernel/printk.c b/kernel/printk.c index 32690a0..a32f291 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -1230,8 +1231,20 @@ int printk_needs_cpu(int cpu) void wake_up_klogd(void) { - if (waitqueue_active(&log_wait)) + unsigned long flags; + + if (waitqueue_active(&log_wait)) { this_cpu_write(printk_pending, 1); + /* Make it visible from any interrupt from now */ + barrier(); + /* + * It's safe to check that even if interrupts are not disabled. + * If we enable nohz adaptive mode concurrently, we'll see the + * printk_pending value and thus keep a periodic tick behaviour. + */ + if (cpuset_adaptive_nohz()) + smp_cpuset_update_nohz(smp_processor_id()); + } } /** -- 1.7.5.4