Commit b2add73d authored by Guillaume Knispel's avatar Guillaume Knispel Committed by Linus Torvalds

poll/select: initialize triggered field of struct poll_wqueues

The triggered field of struct poll_wqueues introduced in commit
5f820f64 ("poll: allow f_op->poll to
sleep").

It was first set to 1 in pollwake() (now __pollwake() ), tested and
later set to 0 in poll_schedule_timeout(), but not initialized before.

As a result when the process needs to sleep, triggered was likely to be
non-zero even if pollwake() is not called before the first
poll_schedule_timeout(), meaning schedule_hrtimeout_range() would not be
called and an extra loop calling all ->poll() would be done.

This patch initialize triggered to 0 in poll_initwait() so the ->poll()
are not called twice before the process goes to sleep when it needs to.
Signed-off-by: default avatarGuillaume Knispel <gknispel@proformatique.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5d12dc1f
...@@ -110,6 +110,7 @@ void poll_initwait(struct poll_wqueues *pwq) ...@@ -110,6 +110,7 @@ void poll_initwait(struct poll_wqueues *pwq)
{ {
init_poll_funcptr(&pwq->pt, __pollwait); init_poll_funcptr(&pwq->pt, __pollwait);
pwq->polling_task = current; pwq->polling_task = current;
pwq->triggered = 0;
pwq->error = 0; pwq->error = 0;
pwq->table = NULL; pwq->table = NULL;
pwq->inline_index = 0; pwq->inline_index = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment