From: David Miller <davem@davemloft.net>
To: David.Laight@ACULAB.COM
Cc: yangyingliang@huawei.com, eric.dumazet@gmail.com,
netdev@vger.kernel.org, brouer@redhat.com, jpirko@redhat.com,
jbrouer@redhat.com
Subject: Re: [PATCH] net: sched: tbf: fix calculation of max_size
Date: Sun, 01 Dec 2013 20:11:10 -0500 (EST) [thread overview]
Message-ID: <20131201.201110.1947727947032213373.davem@davemloft.net> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7443@saturn3.aculab.com>
From: "David Laight" <David.Laight@ACULAB.COM>
Date: Mon, 25 Nov 2013 12:22:30 -0000
>> 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. And 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().
>
> Why not adjust the calculations so that the number of allocated tokens
> can go negative?
>
> So allow the transfer if the number of tokens is +ve and then subtract
> the number needed for the message itself.
>
> I think this would change the semantics of the configured 'burst' value
> very slightly (to 'at least' from 'at most') but the average would still
> be correct.
>
> FWIW I've done similar rate limiters that run directly in units of 'time'.
> The fact that system time advances automatically generates credit.
Yang has responded to your concerns, are they addressed?
next prev parent reply other threads:[~2013-12-02 1:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 7:25 [PATCH net v3 0/2] net: sched: fix some issues Yang Yingliang
2013-11-19 7:25 ` [PATCH net v3 1/2] net: sched: tbf: fix calculation of max_size Yang Yingliang
2013-11-19 9:38 ` Jesper Dangaard Brouer
2013-11-20 2:14 ` Yang Yingliang
2013-11-20 10:04 ` Jesper Dangaard Brouer
2013-11-20 12:50 ` Yang Yingliang
2013-11-23 19:06 ` Eric Dumazet
2013-11-24 7:28 ` Yang Yingliang
2013-11-24 18:40 ` Eric Dumazet
2013-11-25 3:43 ` Yang Yingliang
2013-11-25 12:04 ` [PATCH] " Yang Yingliang
2013-11-25 12:22 ` David Laight
2013-11-26 1:28 ` Yang Yingliang
2013-11-26 2:35 ` Yang Yingliang
2013-12-02 1:11 ` David Miller [this message]
2013-12-02 10:29 ` David Laight
2013-12-02 16:45 ` David Miller
2013-12-03 0:59 ` Yang Yingliang
2013-11-19 7:25 ` [PATCH net v3 2/2] net: sched: htb: fix 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=20131201.201110.1947727947032213373.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=David.Laight@ACULAB.COM \
--cc=brouer@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=jbrouer@redhat.com \
--cc=jpirko@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=yangyingliang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).