netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] net: unix: Align send data_len up to PAGE_SIZE
@ 2014-05-15 15:56 Kirill Tkhai
  2014-05-15 17:39 ` Eric Dumazet
  2014-05-16 20:04 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Kirill Tkhai @ 2014-05-15 15:56 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Eric Dumazet

Using whole of allocated pages reduces requested skb->data size.
This is just a little more thriftily allocation.
    
netperf does not show difference with the current performance.
    
Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
---
 net/unix/af_unix.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 749f80c..e968843 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1492,10 +1492,14 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
 	if (len > sk->sk_sndbuf - 32)
 		goto out;
 
-	if (len > SKB_MAX_ALLOC)
+	if (len > SKB_MAX_ALLOC) {
 		data_len = min_t(size_t,
 				 len - SKB_MAX_ALLOC,
 				 MAX_SKB_FRAGS * PAGE_SIZE);
+		data_len = PAGE_ALIGN(data_len);
+
+		BUILD_BUG_ON(SKB_MAX_ALLOC < PAGE_SIZE);
+	}
 
 	skb = sock_alloc_send_pskb(sk, len - data_len, data_len,
 				   msg->msg_flags & MSG_DONTWAIT, &err,
@@ -1670,6 +1674,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
 
 		data_len = max_t(int, 0, size - SKB_MAX_HEAD(0));
 
+		data_len = min_t(size_t, size, PAGE_ALIGN(data_len));
+
 		skb = sock_alloc_send_pskb(sk, size - data_len, data_len,
 					   msg->msg_flags & MSG_DONTWAIT, &err,
 					   get_order(UNIX_SKB_FRAGS_SZ));

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

* Re: [PATCH net-next v3] net: unix: Align send data_len up to PAGE_SIZE
  2014-05-15 15:56 [PATCH net-next v3] net: unix: Align send data_len up to PAGE_SIZE Kirill Tkhai
@ 2014-05-15 17:39 ` Eric Dumazet
  2014-05-16 20:04 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2014-05-15 17:39 UTC (permalink / raw)
  To: Kirill Tkhai; +Cc: netdev, David Miller

On Thu, 2014-05-15 at 19:56 +0400, Kirill Tkhai wrote:
> Using whole of allocated pages reduces requested skb->data size.
> This is just a little more thriftily allocation.
>     
> netperf does not show difference with the current performance.
>     
> Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
> ---
>  net/unix/af_unix.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Acked-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net-next v3] net: unix: Align send data_len up to PAGE_SIZE
  2014-05-15 15:56 [PATCH net-next v3] net: unix: Align send data_len up to PAGE_SIZE Kirill Tkhai
  2014-05-15 17:39 ` Eric Dumazet
@ 2014-05-16 20:04 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-05-16 20:04 UTC (permalink / raw)
  To: ktkhai; +Cc: netdev, eric.dumazet

From: Kirill Tkhai <ktkhai@parallels.com>
Date: Thu, 15 May 2014 19:56:28 +0400

> Using whole of allocated pages reduces requested skb->data size.
> This is just a little more thriftily allocation.
>     
> netperf does not show difference with the current performance.
>     
> Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>

Applied, thank you.

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

end of thread, other threads:[~2014-05-16 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-15 15:56 [PATCH net-next v3] net: unix: Align send data_len up to PAGE_SIZE Kirill Tkhai
2014-05-15 17:39 ` Eric Dumazet
2014-05-16 20:04 ` 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).