From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753557AbcANE4T (ORCPT ); Wed, 13 Jan 2016 23:56:19 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:35958 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194AbcANE4R (ORCPT ); Wed, 13 Jan 2016 23:56:17 -0500 From: Sergey Senozhatsky X-Google-Original-From: Sergey Senozhatsky To: Andrew Morton Cc: Tejun Heo , Jan Kara , Petr Mladek , Kyle McMartin , Dave Jones , Calvin Owens , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: [RFC][PATCH -next 0/2] cond_resched() some of console_trylock callers Date: Thu, 14 Jan 2016 13:57:21 +0900 Message-Id: <1452747443-9927-1-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, RFC (apologies for sending it during the merge window. no rush) console_unlock() allows to cond_resched() if its caller has set `console_may_schedule' to 1 (this functionality present since commit 'printk: do cond_resched() between lines while outputting to consoles'). The rules are: -- console_lock() always sets `console_may_schedule' to 1 -- console_trylock() always sets `console_may_schedule' to 0 However, console_trylock() callers (among them is printk()) are not necessarily executing in atomic contexts, and some of them can cond_resched() in console_unlock(). So console_trylock() can set `console_may_schedule' to 0 only if cond_resched() is invalid in the current context, and set it to 1 otherwise. Patch 0001 addresses a theoretical loss of printk messages and, at the same time, serves as a preparation work for 0002. Sergey Senozhatsky (2): printk: move can_use_console out of console_trylock_for_printk printk: set may_schedule for some of console_trylock callers kernel/printk/printk.c | 84 ++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 44 deletions(-) -- 2.7.0