On Mon, 31 Dec 2007, David Miller wrote: > From: "Ilpo_Järvinen" <[EMAIL PROTECTED]> > Date: Mon, 31 Dec 2007 12:47:51 +0200 > > > Signed-off-by: Ilpo Järvinen <[EMAIL PROTECTED]> > ... > > > > - 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.