Messages in this thread | | | From | Jeff Moyer <> | Subject | Re: [PATCH] CFQ:optimize the cfq_should_preempt() | Date | Wed, 10 Jun 2009 13:59:30 -0400 |
| |
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
| |