linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add rb_next in block throttle
@ 2010-11-26 14:06 Hillf Danton
  2010-11-30 14:36 ` Vivek Goyal
  0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2010-11-26 14:06 UTC (permalink / raw)
  To: linux-kernel

When selecting group for dispatching, the first entry of the service
tree is sequentially dequeued, then the first entry is recomputed by
calling rb_first().

When the first is removed from service tree, new first could also be
computed with rb_next(), since it could be faster than rb_first in
this special environment.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/block/blk-throttle.c	2010-11-01 19:54:12.000000000 +0800
+++ b/block/blk-throttle.c	2010-11-26 21:27:40.000000000 +0800
@@ -251,7 +251,7 @@ static void rb_erase_init(struct rb_node
 static void throtl_rb_erase(struct rb_node *n, struct throtl_rb_root *root)
 {
 	if (root->left == n)
-		root->left = NULL;
+		root->left = rb_next(n);
 	rb_erase_init(n, &root->rb);
 	--root->count;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add rb_next in block throttle
  2010-11-26 14:06 [PATCH] add rb_next in block throttle Hillf Danton
@ 2010-11-30 14:36 ` Vivek Goyal
  2010-12-01 13:11   ` Hillf Danton
  0 siblings, 1 reply; 4+ messages in thread
From: Vivek Goyal @ 2010-11-30 14:36 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-kernel

On Fri, Nov 26, 2010 at 10:06:27PM +0800, Hillf Danton wrote:
> When selecting group for dispatching, the first entry of the service
> tree is sequentially dequeued, then the first entry is recomputed by
> calling rb_first().
> 
> When the first is removed from service tree, new first could also be
> computed with rb_next(), since it could be faster than rb_first in
> this special environment.
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---

Ok. So set the leftmost element with the help of rb_next() at the time of
deletion of existing leftmost element. Not sure whether it is cheaper or
not but does not harm doing it this way.

Have you tested it to make sure nothing is broken?

Thanks
Vivek

> 
> --- a/block/blk-throttle.c	2010-11-01 19:54:12.000000000 +0800
> +++ b/block/blk-throttle.c	2010-11-26 21:27:40.000000000 +0800
> @@ -251,7 +251,7 @@ static void rb_erase_init(struct rb_node
>  static void throtl_rb_erase(struct rb_node *n, struct throtl_rb_root *root)
>  {
>  	if (root->left == n)
> -		root->left = NULL;
> +		root->left = rb_next(n);
>  	rb_erase_init(n, &root->rb);
>  	--root->count;
>  }
> --
> 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add rb_next in block throttle
  2010-11-30 14:36 ` Vivek Goyal
@ 2010-12-01 13:11   ` Hillf Danton
  2010-12-01 14:42     ` Vivek Goyal
  0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2010-12-01 13:11 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: linux-kernel

On Tue, Nov 30, 2010 at 10:36 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> On Fri, Nov 26, 2010 at 10:06:27PM +0800, Hillf Danton wrote:
>> When selecting group for dispatching, the first entry of the service
>> tree is sequentially dequeued, then the first entry is recomputed by
>> calling rb_first().
>>
>> When the first is removed from service tree, new first could also be
>> computed with rb_next(), since it could be faster than rb_first in
>> this special environment.
>>
>> Signed-off-by: Hillf Danton <dhillf@gmail.com>
>> ---
>
> Ok. So set the leftmost element with the help of rb_next() at the time of
> deletion of existing leftmost element. Not sure whether it is cheaper or
> not but does not harm doing it this way.
>
> Have you tested it to make sure nothing is broken?

Hm..if broken, we rush out and gnarl at Andrea Arcangeli as loud as we could.

Thanks
Hillf
>
> Thanks
> Vivek
>
>>
>> --- a/block/blk-throttle.c    2010-11-01 19:54:12.000000000 +0800
>> +++ b/block/blk-throttle.c    2010-11-26 21:27:40.000000000 +0800
>> @@ -251,7 +251,7 @@ static void rb_erase_init(struct rb_node
>>  static void throtl_rb_erase(struct rb_node *n, struct throtl_rb_root *root)
>>  {
>>       if (root->left == n)
>> -             root->left = NULL;
>> +             root->left = rb_next(n);
>>       rb_erase_init(n, &root->rb);
>>       --root->count;
>>  }
>> --
>> 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/
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add rb_next in block throttle
  2010-12-01 13:11   ` Hillf Danton
@ 2010-12-01 14:42     ` Vivek Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Vivek Goyal @ 2010-12-01 14:42 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-kernel

On Wed, Dec 01, 2010 at 09:11:01PM +0800, Hillf Danton wrote:
> On Tue, Nov 30, 2010 at 10:36 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> > On Fri, Nov 26, 2010 at 10:06:27PM +0800, Hillf Danton wrote:
> >> When selecting group for dispatching, the first entry of the service
> >> tree is sequentially dequeued, then the first entry is recomputed by
> >> calling rb_first().
> >>
> >> When the first is removed from service tree, new first could also be
> >> computed with rb_next(), since it could be faster than rb_first in
> >> this special environment.
> >>
> >> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> >> ---
> >
> > Ok. So set the leftmost element with the help of rb_next() at the time of
> > deletion of existing leftmost element. Not sure whether it is cheaper or
> > not but does not harm doing it this way.
> >
> > Have you tested it to make sure nothing is broken?
> 
> Hm..if broken, we rush out and gnarl at Andrea Arcangeli as loud as we could.
> 

Well, some testing is always good. This looks simple enough though.

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Vivek

> Thanks
> Hillf
> >
> > Thanks
> > Vivek
> >
> >>
> >> --- a/block/blk-throttle.c    2010-11-01 19:54:12.000000000 +0800
> >> +++ b/block/blk-throttle.c    2010-11-26 21:27:40.000000000 +0800
> >> @@ -251,7 +251,7 @@ static void rb_erase_init(struct rb_node
> >>  static void throtl_rb_erase(struct rb_node *n, struct throtl_rb_root *root)
> >>  {
> >>       if (root->left == n)
> >> -             root->left = NULL;
> >> +             root->left = rb_next(n);
> >>       rb_erase_init(n, &root->rb);
> >>       --root->count;
> >>  }
> >> --
> >> 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/
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-01 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-26 14:06 [PATCH] add rb_next in block throttle Hillf Danton
2010-11-30 14:36 ` Vivek Goyal
2010-12-01 13:11   ` Hillf Danton
2010-12-01 14:42     ` Vivek Goyal

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