netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: add scheduling point in recvmmsg/sendmmsg
@ 2016-01-08 16:37 Eric Dumazet
  2016-01-11  3:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2016-01-08 16:37 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Willem de Bruijn

From: Eric Dumazet <edumazet@google.com>

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: Eric Dumazet <edumazet@google.com>
---
 net/socket.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/socket.c b/net/socket.c
index d730ef9dfbf0..91c2de6f5020 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2041,6 +2041,7 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
 		if (err)
 			break;
 		++datagrams;
+		cond_resched();
 	}
 
 	fput_light(sock->file, fput_needed);
@@ -2236,6 +2237,7 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
 		/* Out of band data, return right away */
 		if (msg_sys.msg_flags & MSG_OOB)
 			break;
+		cond_resched();
 	}
 
 out_put:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: add scheduling point in recvmmsg/sendmmsg
  2016-01-08 16:37 [PATCH net-next] net: add scheduling point in recvmmsg/sendmmsg Eric Dumazet
@ 2016-01-11  3:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-01-11  3:59 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, willemb

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 08 Jan 2016 08:37:20 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> 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: Eric Dumazet <edumazet@google.com>

Seems reasonable, applied, thanks Eric.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-11  3:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-08 16:37 [PATCH net-next] net: add scheduling point in recvmmsg/sendmmsg Eric Dumazet
2016-01-11  3:59 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).