File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,21 @@ static inline void sk_busy_loop(struct sock *sk, int nonblock)
121
121
#endif
122
122
}
123
123
124
+ static inline void sock_poll_busy_loop (struct socket * sock , __poll_t events )
125
+ {
126
+ if (sk_can_busy_loop (sock -> sk ) &&
127
+ events && (events & POLL_BUSY_LOOP )) {
128
+ /* once, only if requested by syscall */
129
+ sk_busy_loop (sock -> sk , 1 );
130
+ }
131
+ }
132
+
133
+ /* if this socket can poll_ll, tell the system call */
134
+ static inline __poll_t sock_poll_busy_flag (struct socket * sock )
135
+ {
136
+ return sk_can_busy_loop (sock -> sk ) ? POLL_BUSY_LOOP : 0 ;
137
+ }
138
+
124
139
/* used in the NIC receive handler to mark the skb */
125
140
static inline void skb_mark_napi_id (struct sk_buff * skb ,
126
141
struct napi_struct * napi )
Original file line number Diff line number Diff line change @@ -1117,24 +1117,11 @@ EXPORT_SYMBOL(sock_create_lite);
1117
1117
/* No kernel lock held - perfect */
1118
1118
static __poll_t sock_poll (struct file * file , poll_table * wait )
1119
1119
{
1120
- __poll_t busy_flag = 0 ;
1121
- struct socket * sock ;
1122
-
1123
- /*
1124
- * We can't return errors to poll, so it's either yes or no.
1125
- */
1126
- sock = file -> private_data ;
1127
-
1128
- if (sk_can_busy_loop (sock -> sk )) {
1129
- /* this socket can poll_ll so tell the system call */
1130
- busy_flag = POLL_BUSY_LOOP ;
1131
-
1132
- /* once, only if requested by syscall */
1133
- if (wait && (wait -> _key & POLL_BUSY_LOOP ))
1134
- sk_busy_loop (sock -> sk , 1 );
1135
- }
1120
+ struct socket * sock = file -> private_data ;
1121
+ __poll_t events = poll_requested_events (wait );
1136
1122
1137
- return busy_flag | sock -> ops -> poll (file , sock , wait );
1123
+ sock_poll_busy_loop (sock , events );
1124
+ return sock -> ops -> poll (file , sock , wait ) | sock_poll_busy_flag (sock );
1138
1125
}
1139
1126
1140
1127
static int sock_mmap (struct file * file , struct vm_area_struct * vma )
You can’t perform that action at this time.
0 commit comments