[RFC][PATCH -next 0/2] cond_resched() some of console_trylock callers

From: Sergey Senozhatsky
Date: Wed Jan 13 2016 - 23:56:58 EST


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