Commit a78cb84c authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: add scheduling point in recvmmsg/sendmmsg

Applications often have to reduce number of datagrams
they receive or send per system call to avoid starvation problems.

Really the kernel should take care of this by using cond_resched(),
so that applications can experiment bigger batch sizes.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d171f39
...@@ -2041,6 +2041,7 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, ...@@ -2041,6 +2041,7 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
if (err) if (err)
break; break;
++datagrams; ++datagrams;
cond_resched();
} }
fput_light(sock->file, fput_needed); fput_light(sock->file, fput_needed);
...@@ -2236,6 +2237,7 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, ...@@ -2236,6 +2237,7 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
/* Out of band data, return right away */ /* Out of band data, return right away */
if (msg_sys.msg_flags & MSG_OOB) if (msg_sys.msg_flags & MSG_OOB)
break; break;
cond_resched();
} }
out_put: out_put:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment