2525
2626struct poll_table_struct ;
2727
28- /*
28+ /*
2929 * structures and helpers for f_op->poll implementations
3030 */
3131typedef void (* poll_queue_proc )(struct file * , wait_queue_head_t * , struct poll_table_struct * );
3232
3333/*
34- * Do not touch the structure directly, use the access functions
35- * poll_does_not_wait() and poll_requested_events() instead.
34+ * Do not touch the structure directly, use the access function
35+ * poll_requested_events() instead.
3636 */
3737typedef struct poll_table_struct {
3838 poll_queue_proc _qproc ;
@@ -41,18 +41,16 @@ typedef struct poll_table_struct {
4141
4242static inline void poll_wait (struct file * filp , wait_queue_head_t * wait_address , poll_table * p )
4343{
44- if (p && p -> _qproc && wait_address )
44+ if (p && p -> _qproc ) {
4545 p -> _qproc (filp , wait_address , p );
46- }
47-
48- /*
49- * Return true if it is guaranteed that poll will not wait. This is the case
50- * if the poll() of another file descriptor in the set got an event, so there
51- * is no need for waiting.
52- */
53- static inline bool poll_does_not_wait (const poll_table * p )
54- {
55- return p == NULL || p -> _qproc == NULL ;
46+ /*
47+ * This memory barrier is paired in the wq_has_sleeper().
48+ * See the comment above prepare_to_wait(), we need to
49+ * ensure that subsequent tests in this thread can't be
50+ * reordered with __add_wait_queue() in _qproc() paths.
51+ */
52+ smp_mb ();
53+ }
5654}
5755
5856/*
0 commit comments