Skip to content

Commit b2add73

Browse files
Guillaume Knispeltorvalds
authored andcommitted
poll/select: initialize triggered field of struct poll_wqueues
The triggered field of struct poll_wqueues introduced in commit 5f820f6 ("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: Guillaume Knispel <gknispel@proformatique.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Tejun Heo <tj@kernel.org> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5d12dc1 commit b2add73

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎fs/select.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void poll_initwait(struct poll_wqueues *pwq)
110110
{
111111
init_poll_funcptr(&pwq->pt, __pollwait);
112112
pwq->polling_task = current;
113+
pwq->triggered = 0;
113114
pwq->error = 0;
114115
pwq->table = NULL;
115116
pwq->inline_index = 0;

0 commit comments

Comments
 (0)