lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 31 Dec 2007 16:17:58 +0200 (EET)
From:	"Ilpo Järvinen" <ilpo.jarvinen@...sinki.fi>
To:	David Miller <davem@...emloft.net>
cc:	Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH 3/9] [TCP]: Remove unnecessary local variables

On Mon, 31 Dec 2007, David Miller wrote:

> From: "Ilpo_Järvinen" <ilpo.jarvinen@...sinki.fi>
> Date: Mon, 31 Dec 2007 12:47:51 +0200
> 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...sinki.fi>
>  ...
> >  
> > -	in_flight = tcp_packets_in_flight(tp);
> > -	cwnd = tp->snd_cwnd;
> > -	if (in_flight < cwnd)
> > -		return (cwnd - in_flight);
> > +	if (tcp_packets_in_flight(tp) < tp->snd_cwnd)
> > +		return tp->snd_cwnd - tcp_packets_in_flight(tp);
> >  
> 
> I don't know about this one.
> 
> Although tcp_packets_in_flight() is inline and the compiler
> should CSE the first call into a local register and not
> redo the calculation:
> 
> 1) That isn't something to rely upon.  The compiler might look
>    at a function or set of functions in this file and decide
>    to not inline tcp_packets_in_flight() or not see the CSE
>    opportunity and that the second call is redundant.

How about doing something really straight-forward then:

  return max_t(s32, tp->snd_cwnd - tcp_packets_in_flight(tp), 0);

...I was a bit unsure to add such type trickery and thus didn't go
for that right away.

> So best to keep the local vars here.
> 
> I also think the code is clearer that way too.

Fair enough.


-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ