netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] tcp: tcp_sendmsg() page recycling
Date: Sun, 04 Dec 2011 09:20:53 -0800	[thread overview]
Message-ID: <1323019253.1785.7.camel@joe2Laptop> (raw)
In-Reply-To: <1323018317.2762.143.camel@edumazet-laptop>

On Sun, 2011-12-04 at 18:05 +0100, Eric Dumazet wrote:
> If our TCP_PAGE(sk) is not shared (page_count() == 1), we can set page
> offset to 0.
[]
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
[]
> @@ -1009,7 +1009,12 @@ new_segment:
>  				int merge = 0;
>  				int i = skb_shinfo(skb)->nr_frags;
>  				struct page *page = TCP_PAGE(sk);
> -				int off = TCP_OFF(sk);
> +				int off;
> +
> +				if (page && page_count(page) == 1)
> +					TCP_OFF(sk) = 0;
> +
> +				off = TCP_OFF(sk);

This might be clearer and take one less indirection as

				if (page && page_count(page) == 1) {
					TCP_OFF(sk) = 0;
					off = 0;
				} else {
					off = 0;
				}

or maybe

				if (page && page_count(page) == 1)
					off = TCP_OFF(sk) = 0;
				else
					off = 0;

And maybe the TCP_OFF and TCP_PAGE macros should be removed.

  reply	other threads:[~2011-12-04 17:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-04 17:05 [PATCH net-next] tcp: tcp_sendmsg() page recycling Eric Dumazet
2011-12-04 17:20 ` Joe Perches [this message]
2011-12-04 18:27   ` Nicolas de Pesloüan
2011-12-04 18:54     ` Joe Perches
2011-12-05 11:07   ` [PATCH net-next] tcp: remove TCP_OFF and TCP_PAGE macros Eric Dumazet
2011-12-05 23:47     ` David Miller
2011-12-04 17:36 ` [PATCH net-next] tcp: tcp_sendmsg() page recycling Eric Dumazet
2011-12-04 18:14   ` David Miller
2011-12-04 18:21 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323019253.1785.7.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).