* [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
@ 2006-04-24 23:25 Hua Zhong
2006-04-25 5:34 ` Herbert Xu
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Hua Zhong @ 2006-04-24 23:25 UTC (permalink / raw)
To: davem, netdev
Hi,
I am developing a profiling tool to check if likely/unlikely usages are wise. I find that the following one is always a miss:
# Hit # miss Function:Filename@Line
! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
There is a chance that my tool is buggy, but I just want to confirm with you whether this does look suspicious and what your opinion is.
Signed-off-by: Hua Zhong <hzhong@gmail.com>
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index a28ae59..743016b 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -465,7 +465,7 @@ #define SYSCTL_FLAG_SACK 0x4
TCP_INC_STATS(TCP_MIB_OUTSEGS);
err = icsk->icsk_af_ops->queue_xmit(skb, 0);
- if (unlikely(err <= 0))
+ if (likely(err <= 0))
return err;
tcp_enter_cwr(sk);
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
2006-04-24 23:25 [PATCH]: suspicious unlikely usage in tcp_transmit_skb() Hua Zhong
@ 2006-04-25 5:34 ` Herbert Xu
2006-04-25 17:01 ` Stephen Hemminger
2006-04-26 9:42 ` David S. Miller
2 siblings, 0 replies; 7+ messages in thread
From: Herbert Xu @ 2006-04-25 5:34 UTC (permalink / raw)
To: Hua Zhong; +Cc: davem, netdev
Hua Zhong <hzhong@gmail.com> wrote:
>
> I am developing a profiling tool to check if likely/unlikely usages are wise. I find that the following one is always a miss:
>
> # Hit # miss Function:Filename@Line
> ! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
>
> There is a chance that my tool is buggy, but I just want to confirm with you whether this does look suspicious and what your opinion is.
Your tool is correct. The only way for it to fall through is if
we encounter local congestion.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
2006-04-24 23:25 [PATCH]: suspicious unlikely usage in tcp_transmit_skb() Hua Zhong
2006-04-25 5:34 ` Herbert Xu
@ 2006-04-25 17:01 ` Stephen Hemminger
2006-04-25 21:46 ` David S. Miller
2006-04-26 9:42 ` David S. Miller
2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2006-04-25 17:01 UTC (permalink / raw)
To: Hua Zhong; +Cc: davem, netdev
On Mon, 24 Apr 2006 16:25:39 -0700
Hua Zhong <hzhong@gmail.com> wrote:
> Hi,
>
> I am developing a profiling tool to check if likely/unlikely usages are wise. I find that the following one is always a miss:
>
> # Hit # miss Function:Filename@Line
> ! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
>
> There is a chance that my tool is buggy, but I just want to confirm with you whether this does look suspicious and what your opinion is.
>
> Signed-off-by: Hua Zhong <hzhong@gmail.com>
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index a28ae59..743016b 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -465,7 +465,7 @@ #define SYSCTL_FLAG_SACK 0x4
> TCP_INC_STATS(TCP_MIB_OUTSEGS);
>
> err = icsk->icsk_af_ops->queue_xmit(skb, 0);
> - if (unlikely(err <= 0))
> + if (likely(err <= 0))
> return err;
>
> tcp_enter_cwr(sk);
How about just taking off the likely/unlikely in this case.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
2006-04-25 17:01 ` Stephen Hemminger
@ 2006-04-25 21:46 ` David S. Miller
2006-04-25 22:16 ` Stephen Hemminger
0 siblings, 1 reply; 7+ messages in thread
From: David S. Miller @ 2006-04-25 21:46 UTC (permalink / raw)
To: shemminger; +Cc: hzhong, netdev
From: Stephen Hemminger <shemminger@osdl.org>
Date: Tue, 25 Apr 2006 10:01:49 -0700
> > # Hit # miss Function:Filename@Line
> > ! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
...
> How about just taking off the likely/unlikely in this case.
Why remove it when we'll now get a 50505 to 0 hit rate?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
2006-04-25 21:46 ` David S. Miller
@ 2006-04-25 22:16 ` Stephen Hemminger
2006-04-26 7:26 ` David S. Miller
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2006-04-25 22:16 UTC (permalink / raw)
To: David S. Miller; +Cc: hzhong, netdev
On Tue, 25 Apr 2006 14:46:49 -0700 (PDT)
"David S. Miller" <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@osdl.org>
> Date: Tue, 25 Apr 2006 10:01:49 -0700
>
> > > # Hit # miss Function:Filename@Line
> > > ! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
> ...
> > How about just taking off the likely/unlikely in this case.
>
> Why remove it when we'll now get a 50505 to 0 hit rate?
Depends on the data stream, but I guess if we are seeing high loss
we really don't care about the CPU branch prediction.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
2006-04-25 22:16 ` Stephen Hemminger
@ 2006-04-26 7:26 ` David S. Miller
0 siblings, 0 replies; 7+ messages in thread
From: David S. Miller @ 2006-04-26 7:26 UTC (permalink / raw)
To: shemminger; +Cc: hzhong, netdev
From: Stephen Hemminger <shemminger@osdl.org>
Date: Tue, 25 Apr 2006 15:16:35 -0700
> On Tue, 25 Apr 2006 14:46:49 -0700 (PDT)
> "David S. Miller" <davem@davemloft.net> wrote:
>
> > From: Stephen Hemminger <shemminger@osdl.org>
> > Date: Tue, 25 Apr 2006 10:01:49 -0700
> >
> > > > # Hit # miss Function:Filename@Line
> > > > ! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
> > ...
> > > How about just taking off the likely/unlikely in this case.
> >
> > Why remove it when we'll now get a 50505 to 0 hit rate?
>
> Depends on the data stream, but I guess if we are seeing high loss
> we really don't care about the CPU branch prediction.
I disagree, this is a hard error condition, and happens only when
af_ops->queue_xmit() cannot send the packet successfully. Under
any normal circumstances whatsoever, it will succeed.
Are you actually looking at the right piece of code? :-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH]: suspicious unlikely usage in tcp_transmit_skb()
2006-04-24 23:25 [PATCH]: suspicious unlikely usage in tcp_transmit_skb() Hua Zhong
2006-04-25 5:34 ` Herbert Xu
2006-04-25 17:01 ` Stephen Hemminger
@ 2006-04-26 9:42 ` David S. Miller
2 siblings, 0 replies; 7+ messages in thread
From: David S. Miller @ 2006-04-26 9:42 UTC (permalink / raw)
To: hzhong; +Cc: netdev
From: Hua Zhong <hzhong@gmail.com>
Date: Mon, 24 Apr 2006 16:25:39 -0700
> Hi,
>
> I am developing a profiling tool to check if likely/unlikely usages are wise. I find that the following one is always a miss:
>
> # Hit # miss Function:Filename@Line
> ! 0 50505 tcp_transmit_skb():net/ipv4/tcp_output.c@468
>
> There is a chance that my tool is buggy, but I just want to confirm with you whether this does look suspicious and what your opinion is.
>
> Signed-off-by: Hua Zhong <hzhong@gmail.com>
Your patch is semantically correct but does not apply, because your
email client has turned all of the tab characters in the patch into
spaces. This corrupts the patch and makes it unusable.
This problem is hit by pretty much every single gmail user that tries
to send a patch for the first time. I wish gmail would not mangle
ascii text by default.
Please fix this and repost, retaining a proper changelog entry and
signed off line, thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-04-26 9:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-24 23:25 [PATCH]: suspicious unlikely usage in tcp_transmit_skb() Hua Zhong
2006-04-25 5:34 ` Herbert Xu
2006-04-25 17:01 ` Stephen Hemminger
2006-04-25 21:46 ` David S. Miller
2006-04-25 22:16 ` Stephen Hemminger
2006-04-26 7:26 ` David S. Miller
2006-04-26 9:42 ` David S. 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).