Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-16 Thread Vivek Goyal
On Wed, Oct 16, 2013 at 11:53:44AM -0400, Tejun Heo wrote: > Hello, > > On Wed, Oct 16, 2013 at 10:14:06AM -0400, Vivek Goyal wrote: > > - First of all, if you think that a group is entitiled for tokens even > > when it is not doing IO, then why are you truncating the tokens after > > dispatch

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-16 Thread Tejun Heo
Hello, On Wed, Oct 16, 2013 at 10:14:06AM -0400, Vivek Goyal wrote: > - First of all, if you think that a group is entitiled for tokens even > when it is not doing IO, then why are you truncating the tokens after > dispatch of a BIO. > > - Second in general it does not seem right that a group

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-16 Thread Hong zhi guo
Hi, Vivek, Thanks for your elaboration. I got your points. I'll update the patch to have such logic. Do you think adding below logic in tg_with_in_bps_limit enough? if (!sq->nr_queued[rw]) { trim the token to bucket depth; } Thanks On Wed, Oct 16, 2013 at 10:14 PM, Vivek Goyal wrote: > On

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-16 Thread Vivek Goyal
On Wed, Oct 16, 2013 at 02:09:40PM +0800, Hong zhi guo wrote: > Hi, Vivek, > > Thanks for your careful review. I'll rename t_c to last_dispatch, it's > much better. > > For the big burst issue, I've different opinion. Let's discuss it. > > Any time a big IO means a big burst. Even if it's thrott

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-15 Thread Hong zhi guo
Hi, Vivek, Thanks for your careful review. I'll rename t_c to last_dispatch, it's much better. For the big burst issue, I've different opinion. Let's discuss it. Any time a big IO means a big burst. Even if it's throttled at first time, queued in the service_queue, and then waited for a while, w

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-15 Thread Vivek Goyal
On Mon, Oct 14, 2013 at 05:09:17PM +0800, Hong Zhiguo wrote: [..] Hi Hong, Thanks for the token based throttling implementation. In general it looks good and it simplies the logic. Couple of comments/concerns below. > @@ -133,14 +135,13 @@ struct throtl_grp { > /* IOPS limits */ > u

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-15 Thread Jens Axboe
On Tue, Oct 15 2013, Hong zhi guo wrote: > Hi, Tejun, > > I did the test for 3 levels hierarchy. It works. > > Preparation > > 1) mount subsys blkio with "__DEVEL__sane_behavior" > 2) Create 3 levels of directories under the blkio mount point: > mkdir 1 > mkdir 1/2 > mkdi

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-15 Thread Vivek Goyal
On Mon, Oct 14, 2013 at 09:36:20AM -0400, Tejun Heo wrote: > Hello, > > On Mon, Oct 14, 2013 at 05:09:17PM +0800, Hong Zhiguo wrote: > > From: Hong Zhiguo > > > > Token bucket algorithm(http://en.wikipedia.org/wiki/Token_bucket) > > is very simple and widely used for rate limiting and shaping. >

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-15 Thread Hong zhi guo
Hi, Tejun, I did the test for 3 levels hierarchy. It works. Preparation 1) mount subsys blkio with "__DEVEL__sane_behavior" 2) Create 3 levels of directories under the blkio mount point: mkdir 1 mkdir 1/2 mkdir 1/2/3 3) start 3 bash sessions, write their PIDs into: 1/

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-14 Thread Tejun Heo
On Mon, Oct 14, 2013 at 09:53:54PM +0800, Hong zhi guo wrote: > I've not tested hierarchical setup yet. I'll do it tomorrow. > BTW, what kind of setup do you expect? Is hierarchy of 2 levels enough? That should cover most of the functionalities but going for 3 levels can't hurt, right? Thanks. -

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-14 Thread Hong zhi guo
Hi, Tejun, I've not tested hierarchical setup yet. I'll do it tomorrow. BTW, what kind of setup do you expect? Is hierarchy of 2 levels enough? Zhiguo On Mon, Oct 14, 2013 at 9:36 PM, Tejun Heo wrote: > Hello, > > Yes, this definitely is the direction we wanna take it. I'll wait for > Vivek to

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-14 Thread Hong zhi guo
Hi, Tejun, I've not tested hierarchical setup yet. I'll do it tomorrow. BTW, what kind of setup do you expect? Is 2 levels of hierarchical enough? Zhiguo On Mon, Oct 14, 2013 at 9:36 PM, Tejun Heo wrote: > Hello, > > Yes, this definitely is the direction we wanna take it. I'll wait for > Vivek

Re: [PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-14 Thread Tejun Heo
Hello, On Mon, Oct 14, 2013 at 05:09:17PM +0800, Hong Zhiguo wrote: > From: Hong Zhiguo > > Token bucket algorithm(http://en.wikipedia.org/wiki/Token_bucket) > is very simple and widely used for rate limiting and shaping. > It's well suitable for blk-throttle. And it natually works for > hierarc

[PATCH v2] blk-throttle: simplify logic by token bucket algorithm

2013-10-14 Thread Hong Zhiguo
From: Hong Zhiguo Token bucket algorithm(http://en.wikipedia.org/wiki/Token_bucket) is very simple and widely used for rate limiting and shaping. It's well suitable for blk-throttle. And it natually works for hierarchical cgroups. So I took it to replace the original time _slicing_|_trimming_|_ex