Commit 87a2fd2
packet: don't unconditionally schedule() in case of MSG_DONTWAIT
In tpacket_snd(), when we've discovered a first frame that is
not in status TP_STATUS_SEND_REQUEST, and return a NULL buffer,
we exit the send routine in case of MSG_DONTWAIT, since we've
finished traversing the mmaped send ring buffer and don't care
about pending frames.
While doing so, we still unconditionally call an expensive
schedule() in the packet_current_frame() "error" path, which
is unnecessary in this case since it's enough to just quit
the function.
Also, in case MSG_DONTWAIT is not set, we should rather test
for need_resched() first and do schedule() only if necessary
since meanwhile pending frames could already have finished
processing and called skb destructor.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 902fefb commit 87a2fd2
1 file changed
+6
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2156 | 2156 | | |
2157 | 2157 | | |
2158 | 2158 | | |
| 2159 | + | |
2159 | 2160 | | |
2160 | 2161 | | |
2161 | 2162 | | |
| |||
2198 | 2199 | | |
2199 | 2200 | | |
2200 | 2201 | | |
2201 | | - | |
2202 | | - | |
| 2202 | + | |
2203 | 2203 | | |
2204 | | - | |
| 2204 | + | |
| 2205 | + | |
2205 | 2206 | | |
2206 | 2207 | | |
2207 | 2208 | | |
| |||
2255 | 2256 | | |
2256 | 2257 | | |
2257 | 2258 | | |
2258 | | - | |
2259 | | - | |
2260 | | - | |
2261 | | - | |
| 2259 | + | |
| 2260 | + | |
2262 | 2261 | | |
2263 | 2262 | | |
2264 | 2263 | | |
| |||
0 commit comments