]> git.baikalelectronics.ru Git - kernel.git/commit
tty: use the new 'flush_delayed_work()' helper to do ldisc flush
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2009 16:20:41 +0000 (09:20 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2009 22:14:31 +0000 (15:14 -0700)
commit5873727cf78c256af359764e63d398a21c7a74a4
treea6bb960fbfeb3579212cd066138f7d159cf66760
parenta1acab3cdc594585dc786dc2d735f8d5d43924d2
tty: use the new 'flush_delayed_work()' helper to do ldisc flush

This way all flush_to_ldisc work is always done through the workqueues,
and we thus have a single point of serialization.  It also means that we
can avoid calling flush_to_ldisc() entirely if there was no delayed work
pending.

[ Side note: using workqueues and keventd as the single way to enter
  flush_to_ldisc() still doesn't absolutely guarantee that we can't have
  concurrency: keventd is multithreaded and has a thread per CPU, and
  while the WORK_STRUCT_PENDING bit guarantees a single work only being
  on the pending list once, the work might be both pending and _running_
  at the same time. Workqueues are not simple. ]

This was also confirmed to fix bugzilla #14388, even without the earlier
locking fix and cleanup (commit 30f596755: "tty: Make flush_to_ldisc()
locking more robust").  So both commits fix the same bug differently,
and either would have worked on its own.  But I'm committing them both
since they are cleanups independent of each other.

Reported-and-tested-by: Boyan <btanastasov@yahoo.co.uk>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/tty_buffer.c