From: David Miller <davem@davemloft.net>
To: tingw.liu@gmail.com
Cc: netdev@vger.kernel.org, kuznet@ms2.inr.ac.ru, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working
Date: Fri, 09 Aug 2013 11:12:29 -0700 (PDT) [thread overview]
Message-ID: <20130809.111229.1955078847385749897.davem@davemloft.net> (raw)
In-Reply-To: <1375792738-19099-1-git-send-email-tingw.liu@gmail.com>
From: Tingwei Liu <tingw.liu@gmail.com>
Date: Tue, 6 Aug 2013 20:38:58 +0800
> When tcp keepalive working elapsed calculated twice while the first time is not needed!
>
> CC: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Signed-off-by: Tingwei Liu <tingw.liu@gmail.com>
Please put a space after "tcp:" in your Subject line prefixes, it looks
awful the way you've done it here.
> @@ -591,11 +591,11 @@ static void tcp_keepalive_timer (unsigned long data)
> if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE)
> goto out;
>
> - elapsed = keepalive_time_when(tp);
> -
> /* It is alive without keepalive 8) */
> - if (tp->packets_out || tcp_send_head(sk))
> + if (tp->packets_out || tcp_send_head(sk)) {
> + elapsed = keepalive_time_when(tp);
> goto resched;
> + }
>
> elapsed = keepalive_time_elapsed(tp);
This is overkill, just delete the second assignment. Your version makes
the code look less elegant and also makes it harder to audit.
next prev parent reply other threads:[~2013-08-09 18:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 12:38 [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working Tingwei Liu
2013-08-09 18:12 ` David Miller [this message]
2013-08-09 21:06 ` Eric Dumazet
-- strict thread matches above, loose matches on Subject: below --
2013-08-06 12:05 Tingwei Liu
2013-08-06 12:23 ` Eric Dumazet
2013-08-06 12:29 ` tingwei liu
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=20130809.111229.1955078847385749897.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=tingw.liu@gmail.com \
/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).