Re: [PATCH] CFQ:optimize the cfq_should_preempt()
From: Jeff Moyer
Date: Wed Jun 10 2009 - 13:59:47 EST
Shan Wei <shanwei@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/