]> git.karo-electronics.de Git - karo-tx-linux.git/commit
printk: release lockbuf_lock before calling console_trylock_for_printk()
authorJan Kara <jack@suse.cz>
Thu, 22 May 2014 00:43:34 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:34 +0000 (10:43 +1000)
commit9f924bd8a193f78b5ad5c7dc767f7fe3f34909bc
tree8a0da4d08d3cd432ae876226e6b3b72f1c919daa
parentb1f1c11c3aa86238082c1b1836efadae2738c909
printk: release lockbuf_lock before calling console_trylock_for_printk()

There's no reason to hold lockbuf_lock when entering
console_trylock_for_printk().

The first thing this function does is to call down_trylock(console_sem)
and if that fails it immediately unlocks lockbuf_lock.  So lockbuf_lock
isn't needed for that branch.  When down_trylock() succeeds, the rest of
console_trylock() is OK without lockbuf_lock (it is called without it from
other places), and the only remaining thing in
console_trylock_for_printk() is can_use_console() call.  For that call
console_sem is enough (it iterates all consoles and checks CON_ANYTIME
flag).

So we drop logbuf_lock before entering console_trylock_for_printk() which
simplifies the code.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/printk/printk.c