lkml.org 
[lkml]   [2009]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] CFQ:optimize the cfq_should_preempt()
Date
Shan Wei <shanwei@cn.fujitsu.com> writes:

> The patch don't fix bug, just optimizes the cfq_should_preempt()
> to preempt higher priority queue.
>
> Additionally, the comment above cfq_preempt_queue() is outdated.
>
>
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
> ---
> block/cfq-iosched.c | 17 +++++------------
> 1 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index a55a9bd..427f522 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -1993,10 +1993,10 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
> if (cfq_slice_used(cfqq))
> return 1;
>
> - if (cfq_class_idle(new_cfqq))
> - return 0;
> -
> - if (cfq_class_idle(cfqq))
> + /*
> + * if new_cfqq is of higher priority, preempting the active queue.
> + */
> + if (new_cfqq->ioprio_class < cfqq->ioprio_class)
> return 1;

Prior to this patch, if both queues were idle, the first if statement
would evaluate to true and we would return 0. With your patch, we fall
through to the rest of the logic in the function. In such a case, I
don't think this is an optimiation. I can't say how likely this is to
happen, though.

What other justfication do you have for this change? Were you able to
measure a performance difference?

Cheers,
Jeff


\
 
 \ /
  Last update: 2009-06-10 20:03    [W:0.041 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site