All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	David Laight <David.Laight@ACULAB.COM>, <brouer@redhat.com>,
	<jpirko@redhat.com>, <jbrouer@redhat.com>
Subject: Re: [PATCH RFC ] net: sched: tbf: fix the calculation of max_size
Date: Tue, 10 Dec 2013 10:29:28 +0800	[thread overview]
Message-ID: <52A67C88.8040606@huawei.com> (raw)
In-Reply-To: <1386601926.30495.323.camel@edumazet-glaptop2.roam.corp.google.com>

On 2013/12/9 23:12, Eric Dumazet wrote:
> On Mon, 2013-12-09 at 21:10 +0800, Yang Yingliang wrote:
>> From: Yang Yingliang <yangyingliang@huawei.com>
>>
>> Current max_size is caluated from rate table. Now, the rate table
>> has been replaced and it's wrong to caculate max_size based on this
>> rate table. It can lead wrong calculation of max_size.
>>
>> The burst in kernel may be lower than user asked, because burst may gets
>> some loss when transform it to buffer(E.g. "burst 40kb rate 30mbit/s")
>> and it seems we cannot avoid this loss. Burst's value(max_size) based on
>> rate table may be equal user asked. If a packet's length is max_size, this
>> packet will be stalled in tbf_dequeue() because its length is above the
>> burst in kernel so that it cannot get enough tokens. The max_size guards
>> against enqueuing packet sizes above q->buffer "time" in tbf_enqueue().
>>
>> To make consistent with the calculation of tokens, this patch add a helper
>> psched_ns_t2l() to calculate burst(max_size) directly to fix this problem.
>>
>> After this fix, we can support to using 64bit rates to calculate burst as well.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>  net/sched/sch_tbf.c | 203 +++++++++++++++++++++++++++++++++++++++-------------
>>  1 file changed, 155 insertions(+), 48 deletions(-)
> 
> 
> There is no way I am going to study this patch.
> 
> There is no way 32bit * 32bit multiply can overflow 64bit.
> 
> If the user gave a stupid input, like a buffer bigger than 4 sec, just
> say no. Nobody ever did such stupid things in the past, and nobody will
> do in the future because it is so wrong and useless.
> 
> q->mtu = max_t(u64, ~0U, PSCHED_TICKS2NS(qopt->mtu));
> 
> q->buffer = max_t(u64, ~0U, PSCHED_TICKS2NS(qopt->buffer));
> 
> Could we keep this code understandable, please ?

Hmm, I cannot figure out why max_t, did you mean min_t?

> 
> 
> 
> 
> 

  reply	other threads:[~2013-12-10  2:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06  7:00 [PATCH net v6 0/2] net: sched: fix two issues Yang Yingliang
2013-12-06  7:00 ` [PATCH net v6 1/2] net: sched: tbf: fix the calculation of max_size Yang Yingliang
2013-12-06 10:56   ` David Laight
2013-12-09  2:26     ` Yang Yingliang
2013-12-09  3:26     ` Yang Yingliang
2013-12-09 10:07       ` David Laight
2013-12-09 12:21         ` Yang Yingliang
2013-12-09 13:10           ` [PATCH RFC ] " Yang Yingliang
2013-12-09 15:12             ` Eric Dumazet
2013-12-10  2:29               ` Yang Yingliang [this message]
2013-12-10  2:39                 ` Eric Dumazet
2013-12-09 13:11           ` [PATCH net v6 1/2] " David Laight
2013-12-10  2:04             ` Yang Yingliang
2013-12-06  7:00 ` [PATCH net v6 2/2] net: sched: htb: fix the calculation of quantum Yang Yingliang

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=52A67C88.8040606@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jbrouer@redhat.com \
    --cc=jpirko@redhat.com \
    --cc=netdev@vger.kernel.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.