From: "Nicolas de Pesloüan" <nicolas.2p.debian@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
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 19:27:18 +0100 [thread overview]
Message-ID: <4EDBBB86.8050406@gmail.com> (raw)
In-Reply-To: <1323019253.1785.7.camel@joe2Laptop>
Le 04/12/2011 18:20, Joe Perches a écrit :
> 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;
Well, those two fragments don't look equivalent to the original one, unless TCP_OFF(sk) happens to
be 0 before the test. But if this is true, then the whole thing seems useless. Do I miss something?
For as far as I understand, the following should be equivalent to Eric's original, but I don't
consider it better than the original.
if (page&& page_count(page) == 1)
off = TCP_OFF(sk) = 0;
else
off = TCP_OFF(sk);
Nicolas.
next prev parent reply other threads:[~2011-12-04 18:27 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
2011-12-04 18:27 ` Nicolas de Pesloüan [this message]
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=4EDBBB86.8050406@gmail.com \
--to=nicolas.2p.debian@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=joe@perches.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).