Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1255033

Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism
Date 2015-10-23 23:50 +0200
Message-ID <qmSnM-5r6-9@gated-at.bofh.it> (permalink)
References <qmRBn-4gB-3@gated-at.bofh.it> <qmRBn-4gB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism "Bendik Rønning Opstad" <bro.devel@gmail.com> - 2015-10-23 23:00 +0200
  Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection  mechanism Eric Dumazet <eric.dumazet@gmail.com> - 2015-10-23 23:50 +0200
    Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism "Bendik Rønning Opstad" <bro.devel@gmail.com> - 2015-10-25 07:00 +0100

csiph-web