瀏覽代碼

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 <meltedpianoman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivo Sieben 12 年之前
父節點
當前提交
bd5d7ce9af
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      drivers/tty/tty_ldisc.c

+ 3 - 1
drivers/tty/tty_ldisc.c

@@ -64,7 +64,9 @@ static void put_ldisc(struct tty_ldisc *ld)
 		return;
 		return;
 	}
 	}
 	raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
 	raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
-	wake_up(&ld->wq_idle);
+
+	if (waitqueue_active(&ld->wq_idle))
+		wake_up(&ld->wq_idle);
 }
 }
 
 
 /**
 /**