Skip to content

Commit

Permalink
tty: Only wakeup the line discipline idle queue when queue is active
Browse files Browse the repository at this point in the history
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 <meltedpianoman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ivo Sieben authored and Greg Kroah-Hartman committed Jan 16, 2013
1 parent b342dd5 commit bd5d7ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/tty/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit bd5d7ce

Please sign in to comment.