]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
packet: don't unconditionally schedule() in case of MSG_DONTWAIT
authorDaniel Borkmann <dborkman@redhat.com>
Wed, 15 Jan 2014 15:25:35 +0000 (16:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Jan 2014 00:17:11 +0000 (16:17 -0800)
commit87a2fd286adf35a87cf6cb30fa80a0726eb74f76
tree0510e7dda15901deb3f4432f41c48539f40baf8c
parent902fefb82ef72a50c78cb4a20cc954b037a98d1c
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>
net/packet/af_packet.c