From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757575Ab2D3X4l (ORCPT ); Mon, 30 Apr 2012 19:56:41 -0400 Received: from mail-qa0-f46.google.com ([209.85.216.46]:62757 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757525Ab2D3X4i (ORCPT ); Mon, 30 Apr 2012 19:56:38 -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 , Hakan Akkan , Ingo Molnar , Kevin Hilman , Max Krasnyansky , "Paul E. McKenney" , Peter Zijlstra , Stephen Hemminger , Steven Rostedt , Sven-Thorsten Dietrich , Thomas Gleixner Subject: [PATCH 15/41] nohz/cpuset: Restart the tick if printk needs it Date: Tue, 1 May 2012 01:54:49 +0200 Message-Id: <1335830115-14335-16-git-send-email-fweisbec@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1335830115-14335-1-git-send-email-fweisbec@gmail.com> References: <1335830115-14335-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: Hakan Akkan Cc: Ingo Molnar Cc: Kevin Hilman Cc: Max Krasnyansky Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Stephen Hemminger Cc: Steven Rostedt Cc: Sven-Thorsten Dietrich Cc: Thomas Gleixner --- 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