From: Ivo Sieben Date: Tue, 18 Dec 2012 14:48:50 +0000 (+0100) Subject: tty: Only wakeup the line discipline idle queue when queue is active X-Git-Tag: upstream/snapshot3+hdmi~5694^2~95 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd5d7ce9afdd0cddc5ab65e20d1134ccad824418;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git tty: Only wakeup the line discipline idle queue when queue is active Before waking up the tty line discipline idle queue first check if the queue is active (non empty). This prevents unnecessary entering the critical section in the wake_up() function and therefore avoid needless scheduling overhead on a PREEMPT_RT system caused by two processes being in the same critical section. Signed-off-by: Ivo Sieben Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index c578229..e96d187 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -64,7 +64,9 @@ static void put_ldisc(struct tty_ldisc *ld) return; } raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags); - wake_up(&ld->wq_idle); + + if (waitqueue_active(&ld->wq_idle)) + wake_up(&ld->wq_idle); } /**