mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] CFQ: delay getting cfq group at the very point we really need it
@ 2010-07-15  1:59 Gui Jianfeng
  2010-07-16 13:52 ` Vivek Goyal
  0 siblings, 1 reply; 2+ messages in thread
From: Gui Jianfeng @ 2010-07-15  1:59 UTC (permalink / raw)
  To: Vivek Goyal, Jens Axboe
  Cc: Jeff Moyer, Corrado Zoccolo, linux kernel mailing list

Delay searching or allocating a cfq group at the very point that
we really need it. This change would save some cycles every time
we're getting a cfq queue.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 block/cfq-iosched.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index eb4086f..9b0cf13 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2820,10 +2820,8 @@ cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync,
 {
 	struct cfq_queue *cfqq, *new_cfqq = NULL;
 	struct cfq_io_context *cic;
-	struct cfq_group *cfqg;
 
 retry:
-	cfqg = cfq_get_cfqg(cfqd, 1);
 	cic = cfq_cic_lookup(cfqd, ioc);
 	/* cic always exists here */
 	cfqq = cic_to_cfqq(cic, is_sync);
@@ -2852,6 +2850,9 @@ retry:
 		}
 
 		if (cfqq) {
+			struct cfq_group *cfqg;
+
+			cfqg = cfq_get_cfqg(cfqd, 1);
 			cfq_init_cfqq(cfqd, cfqq, current->pid, is_sync);
 			cfq_init_prio_data(cfqq, ioc);
 			cfq_link_cfqq_cfqg(cfqq, cfqg);
-- 1.5.4.rc3 

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

* Re: [PATCH] CFQ: delay getting cfq group at the very point we really need it
  2010-07-15  1:59 [PATCH] CFQ: delay getting cfq group at the very point we really need it Gui Jianfeng
@ 2010-07-16 13:52 ` Vivek Goyal
  0 siblings, 0 replies; 2+ messages in thread
From: Vivek Goyal @ 2010-07-16 13:52 UTC (permalink / raw)
  To: Gui Jianfeng
  Cc: Jens Axboe, Jeff Moyer, Corrado Zoccolo, linux kernel mailing list

On Thu, Jul 15, 2010 at 09:59:20AM +0800, Gui Jianfeng wrote:
> Delay searching or allocating a cfq group at the very point that
> we really need it. This change would save some cycles every time
> we're getting a cfq queue.
> 
> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
> ---
>  block/cfq-iosched.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index eb4086f..9b0cf13 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -2820,10 +2820,8 @@ cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync,
>  {
>  	struct cfq_queue *cfqq, *new_cfqq = NULL;
>  	struct cfq_io_context *cic;
> -	struct cfq_group *cfqg;
>  
>  retry:
> -	cfqg = cfq_get_cfqg(cfqd, 1);
>  	cic = cfq_cic_lookup(cfqd, ioc);
>  	/* cic always exists here */
>  	cfqq = cic_to_cfqq(cic, is_sync);
> @@ -2852,6 +2850,9 @@ retry:
>  		}
>  
>  		if (cfqq) {
> +			struct cfq_group *cfqg;
> +
> +			cfqg = cfq_get_cfqg(cfqd, 1);
>  			cfq_init_cfqq(cfqd, cfqq, current->pid, is_sync);

Gui, I noticed that once we have setup a cfqq and cfqg, for subequent
requests we should not come into this function at all because in 
cfq_set_request(), cic will have pointer to cfqq.

So I am not sure in what call path there is substantial saving but anyway,
it should not harm moving cfq_get_cfqg() call down and call it after
cfqq has been allocated.

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

Thanks
Vivek

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

end of thread, other threads:[~2010-07-16 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-15  1:59 [PATCH] CFQ: delay getting cfq group at the very point we really need it Gui Jianfeng
2010-07-16 13:52 ` Vivek Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome