All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bendik Rønning Opstad" <bro.devel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	"Alexey Kuznetsov"
	<kuznet-v/Mj1YrvjDBInbfyfbPRSQ@public.gmane.org>,
	"James Morris" <jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org>,
	"Hideaki YOSHIFUJI"
	<yoshfuji-VfPWfsRibaP+Ru+s062T9g@public.gmane.org>,
	"Patrick McHardy" <kaber-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org>,
	"Jonathan Corbet" <corbet-T1hC0tSOHrs@public.gmane.org>,
	"Eric Dumazet" <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Neal Cardwell"
	<ncardwell-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Tom Herbert" <tom-BjP2VixgY4xUbtYUoyoikg@public.gmane.org>,
	"Yuchung Cheng" <ycheng-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Paolo Abeni" <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Erik Kline" <ek-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Hannes Frederic Sowa"
	<hannes-tFNcAqjVMyqKXQKiL6tip0B+6BGkLq7r@public.gmane.org>,
	"Al Viro"
	<viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	"Jiri Pirko" <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>,
	"Alexander Duyck"
	<alexander.h.duyck-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Florian Westphal" <fw-HFFVJYpyMKqzQB+pC5nmwQ@public.gmane.org>,
	"Daniel Lee" <Longinus00-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Marcelo Ricardo Leitner"
	<mleitner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Daniel Borkmann"
	<daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>,
	"Willem de Bruijn"
	<willemb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Linus Lüssing"
	<linus.luessing-djzkFPsfvsizQB+pC5nmwQ@public.gmane.org>,
	linux-doc-u79uwXL29TasMV2rI37PzA@public.gmane.org
Subject: Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism
Date: Sun, 25 Oct 2015 06:56:29 +0100	[thread overview]
Message-ID: <1799007.TiMX4hfQRk@desktop> (raw)
In-Reply-To: <1445636654.22974.193.camel-XN9IlZ5yJG9HTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>

On Friday, October 23, 2015 02:44:14 PM Eric Dumazet wrote:
> On Fri, 2015-10-23 at 22:50 +0200, Bendik Rønning Opstad wrote:
> 
> >  
> > +/**
> > + * tcp_stream_is_thin_dpifl() - Tests if the stream is thin based on dynamic PIF
> > + *                              limit
> > + * @tp: the tcp_sock struct
> > + *
> > + * Return: true if current packets in flight (PIF) count is lower than
> > + *         the dynamic PIF limit, else false
> > + */
> > +static inline bool tcp_stream_is_thin_dpifl(const struct tcp_sock *tp)
> > +{
> > +	u64 dpif_lim = tp->srtt_us >> 3;
> > +	/* Div by is_thin_min_itt_lim, the minimum allowed ITT
> > +	 * (Inter-transmission time) in usecs.
> > +	 */
> > +	do_div(dpif_lim, tp->thin_dpifl_itt_lower_bound);
> > +	return tcp_packets_in_flight(tp) < dpif_lim;
> > +}
> > +
> This is very strange :
> 
> You are using a do_div() while both operands are 32bits.  A regular
> divide would be ok :
> 
> u32 dpif_lim = (tp->srtt_us >> 3) / tp->thin_dpifl_itt_lower_bound;
> 
> But then, you can avoid the divide by using a multiply, less expensive :
> 
> return	(u64)tcp_packets_in_flight(tp) * tp->thin_dpifl_itt_lower_bound <
> 	(tp->srtt_us >> 3);
> 

You are of course correct. Will fix this and use multiply. Thanks.

WARNING: multiple messages have this Message-ID (diff)
From: "Bendik Rønning Opstad" <bro.devel@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	"Alexey Kuznetsov" <kuznet@ms2.inr.ac.ru>,
	"James Morris" <jmorris@namei.org>,
	"Hideaki YOSHIFUJI" <yoshfuji@linux-ipv6.org>,
	"Patrick McHardy" <kaber@trash.net>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Neal Cardwell" <ncardwell@google.com>,
	"Tom Herbert" <tom@herbertland.com>,
	"Yuchung Cheng" <ycheng@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>, "Erik Kline" <ek@google.com>,
	"Hannes Frederic Sowa" <hannes@stressinduktion.org>,
	"Al Viro" <viro@zeniv.linux.org.uk>,
	"Jiri Pirko" <jiri@resnulli.us>,
	"Alexander Duyck" <alexander.h.duyck@redhat.com>,
	"Florian Westphal" <fw@strlen.de>,
	"Daniel Lee" <Longinus00@gmail.com>,
	"Marcelo Ricardo Leitner" <mleitner@redhat.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Willem de Bruijn" <willemb@google.com>,
	"Linus Lüssing" <linus.luessing@c0d3.blue>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, linux-api@vger.kernel.org,
	"Andreas Petlund" <apetlund@simula.no>,
	"Carsten Griwodz" <griff@simula.no>,
	"Pål Halvorsen" <paalh@simula.no>,
	"Jonas Markussen" <jonassm@ifi.uio.no>,
	"Kristian Evensen" <kristian.evensen@gmail.com>,
	"Kenneth Klette Jonassen" <kennetkl@ifi.uio.no>
Subject: Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism
Date: Sun, 25 Oct 2015 06:56:29 +0100	[thread overview]
Message-ID: <1799007.TiMX4hfQRk@desktop> (raw)
In-Reply-To: <1445636654.22974.193.camel@edumazet-glaptop2.roam.corp.google.com>

On Friday, October 23, 2015 02:44:14 PM Eric Dumazet wrote:
> On Fri, 2015-10-23 at 22:50 +0200, Bendik Rønning Opstad wrote:
> 
> >  
> > +/**
> > + * tcp_stream_is_thin_dpifl() - Tests if the stream is thin based on dynamic PIF
> > + *                              limit
> > + * @tp: the tcp_sock struct
> > + *
> > + * Return: true if current packets in flight (PIF) count is lower than
> > + *         the dynamic PIF limit, else false
> > + */
> > +static inline bool tcp_stream_is_thin_dpifl(const struct tcp_sock *tp)
> > +{
> > +	u64 dpif_lim = tp->srtt_us >> 3;
> > +	/* Div by is_thin_min_itt_lim, the minimum allowed ITT
> > +	 * (Inter-transmission time) in usecs.
> > +	 */
> > +	do_div(dpif_lim, tp->thin_dpifl_itt_lower_bound);
> > +	return tcp_packets_in_flight(tp) < dpif_lim;
> > +}
> > +
> This is very strange :
> 
> You are using a do_div() while both operands are 32bits.  A regular
> divide would be ok :
> 
> u32 dpif_lim = (tp->srtt_us >> 3) / tp->thin_dpifl_itt_lower_bound;
> 
> But then, you can avoid the divide by using a multiply, less expensive :
> 
> return	(u64)tcp_packets_in_flight(tp) * tp->thin_dpifl_itt_lower_bound <
> 	(tp->srtt_us >> 3);
> 

You are of course correct. Will fix this and use multiply. Thanks.


  parent reply	other threads:[~2015-10-25  5:56 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23 20:50 [PATCH RFC net-next 0/2] tcp: Redundant Data Bundling (RDB) Bendik Rønning Opstad
2015-10-23 20:50 ` Bendik Rønning Opstad
2015-10-23 20:50 ` [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2015-10-23 20:50   ` Bendik Rønning Opstad
2015-10-23 21:44   ` Eric Dumazet
2015-10-23 21:44     ` Eric Dumazet
     [not found]     ` <1445636654.22974.193.camel-XN9IlZ5yJG9HTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2015-10-25  5:56       ` Bendik Rønning Opstad [this message]
2015-10-25  5:56         ` Bendik Rønning Opstad
2015-10-23 20:50 ` [PATCH RFC net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad
2015-10-23 20:50   ` Bendik Rønning Opstad
2015-10-26 14:50   ` Neal Cardwell
2015-10-26 14:50     ` Neal Cardwell
2015-10-26 21:35     ` Andreas Petlund
2015-10-26 21:35       ` Andreas Petlund
2015-10-26 21:58       ` Yuchung Cheng
2015-10-26 21:58         ` Yuchung Cheng
2015-10-27 19:15         ` Jonas Markussen
2015-10-27 19:15           ` Jonas Markussen
2015-10-29 22:53         ` Bendik Rønning Opstad
2015-10-29 22:53           ` Bendik Rønning Opstad
2015-11-02  9:18           ` David Laight
2015-11-02  9:18             ` David Laight
2015-11-02  9:37   ` David Laight
2015-11-02  9:37     ` David Laight
2015-11-05  2:06     ` Bendik Rønning Opstad
2015-11-05  2:06       ` Bendik Rønning Opstad
2015-11-05  2:06       ` Bendik Rønning Opstad
2015-10-24  6:11 ` [PATCH RFC net-next 0/2] tcp: " Yuchung Cheng
2015-10-24  6:11   ` Yuchung Cheng
2015-10-24  6:11   ` Yuchung Cheng
2015-10-24  8:00   ` Jonas Markussen
2015-10-24  8:00     ` Jonas Markussen
     [not found]     ` <61F74109-9FDC-485A-978B-714B7AA27445-6miFZF/5cTBuMpJDpNschA@public.gmane.org>
2015-10-24 12:57       ` Eric Dumazet
2015-10-24 12:57         ` Eric Dumazet
2015-11-09 19:40         ` Bendik Rønning Opstad
2015-11-23 16:26 ` [PATCH RFC v2 " Bendik Rønning Opstad
2015-11-23 16:26 ` [PATCH RFC v2 net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2015-11-23 16:26 ` [PATCH RFC v2 net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad
2015-11-23 17:43   ` Eric Dumazet
2015-11-23 20:05     ` Bendik Rønning Opstad
2016-02-02 19:23 ` [PATCH v3 net-next 0/2] tcp: " Bendik Rønning Opstad
2016-02-02 19:23 ` [PATCH v3 net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2016-02-02 19:23 ` [PATCH v3 net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad
2016-02-02 20:35   ` Eric Dumazet
2016-02-03 18:17     ` Bendik Rønning Opstad
2016-02-03 19:34       ` Eric Dumazet
     [not found]         ` <CAF8eE=VOuoNLQHtkRwM9ZG+vJ-uH2ufVW5y_pS24rGqWh4Qa2g@mail.gmail.com>
2016-02-08 17:30           ` Bendik Rønning Opstad
2016-02-08 17:38         ` Bendik Rønning Opstad
2016-02-16 13:51 ` [PATCH v4 net-next 0/2] tcp: " Bendik Rønning Opstad
2016-02-16 13:51 ` [PATCH v4 net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2016-02-16 13:51 ` [PATCH v4 net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad
2016-02-18 15:18   ` Eric Dumazet
2016-02-19 14:12     ` Bendik Rønning Opstad
2016-02-24 21:12 ` [PATCH v5 net-next 0/2] tcp: " Bendik Rønning Opstad
2016-02-24 21:12 ` [PATCH v5 net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2016-02-24 21:12 ` [PATCH v5 net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad
2016-03-02 19:52   ` David Miller
2016-03-02 22:33     ` Bendik Rønning Opstad
2016-03-03 18:06 ` [PATCH v6 net-next 0/2] tcp: " Bendik Rønning Opstad
2016-03-07 19:36   ` David Miller
2016-03-10  0:20   ` Yuchung Cheng
2016-03-10  1:45     ` Jonas Markussen
2016-03-10  2:27       ` Yuchung Cheng
2016-03-12  9:23         ` Jonas Markussen
2016-03-13 23:18     ` Bendik Rønning Opstad
2016-03-14 21:59       ` Yuchung Cheng
2016-03-18 14:25         ` Bendik Rønning Opstad
2016-03-03 18:06 ` [PATCH v6 net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2016-03-03 18:06 ` [PATCH v6 net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad
2016-03-14 21:15   ` Eric Dumazet
2016-03-15  1:04     ` Rick Jones
2016-03-15 18:09       ` Yuchung Cheng
2016-03-18 17:58     ` Bendik Rønning Opstad
2016-03-14 21:54   ` Yuchung Cheng
2016-03-15  0:40     ` Bill Fink
2016-03-17 23:26     ` Bendik Rønning Opstad
2016-03-21 18:54       ` Yuchung Cheng
2016-06-16 17:12         ` Bendik Rønning Opstad
2016-06-22 14:56 ` [PATCH v7 net-next 0/2] tcp: " Bendik Rønning Opstad
2016-06-22 14:56 ` [PATCH v7 net-next 1/2] tcp: Add DPIFL thin stream detection mechanism Bendik Rønning Opstad
2016-06-22 14:56 ` [PATCH v7 net-next 2/2] tcp: Add Redundant Data Bundling (RDB) Bendik Rønning Opstad

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=1799007.TiMX4hfQRk@desktop \
    --to=bro.devel-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Longinus00-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=alexander.h.duyck-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=corbet-T1hC0tSOHrs@public.gmane.org \
    --cc=daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=ek-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=fw-HFFVJYpyMKqzQB+pC5nmwQ@public.gmane.org \
    --cc=hannes-tFNcAqjVMyqKXQKiL6tip0B+6BGkLq7r@public.gmane.org \
    --cc=jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org \
    --cc=jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org \
    --cc=kaber-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org \
    --cc=kuznet-v/Mj1YrvjDBInbfyfbPRSQ@public.gmane.org \
    --cc=linus.luessing-djzkFPsfvsizQB+pC5nmwQ@public.gmane.org \
    --cc=linux-doc-u79uwXL29TasMV2rI37PzA@public.gmane.org \
    --cc=mleitner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ncardwell-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=tom-BjP2VixgY4xUbtYUoyoikg@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=willemb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=ycheng-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=yoshfuji-VfPWfsRibaP+Ru+s062T9g@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.