Re: [PATCH 1/2]block cfq: make queue preempt work for queues fromdifferent workload

From: Corrado Zoccolo
Date: Tue Jan 11 2011 - 16:07:55 EST


Hi Shaohua,
On Tue, Jan 11, 2011 at 9:51 AM, Shaohua Li <shaohua.li@xxxxxxxxx> wrote:
> I got this:
>       fio-874  [007] Â2157.724514:  8,32  m  N cfq874 preempt
>       fio-874  [007] Â2157.724519:  8,32  m  N cfq830 slice expired t=1
>       fio-874  [007] Â2157.724520:  8,32  m  N cfq830 sl_used=1 disp=0 charge=1 iops=0 sect=0
>       fio-874  [007] Â2157.724521:  8,32  m  N cfq830 set_active wl_prio:0 wl_type:0
>       fio-874  [007] Â2157.724522:  8,32  m  N cfq830 Not idling. st->count:1
> cfq830 is an async queue, and preempted by a sync queue cfq874. But since we
> have cfqg->saved_workload_slice mechanism, the preempt is a nop.
> Looks currently our preempt is totally broken if the two queues are not from
> the same workload type.
> Below patch fixes it. This will might make async queue starvation, but it's
> what our old code does before cgroup is added.
have you measured latency improvements by un-breaking preemption?
AFAIK, preemption behaviour changed since 2.6.33, before cgroups were
added, and the latency before the changes that weakened preemption in
2.6.33 was far worse.

Thanks,
Corrado
>
> Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>
>
> ---
> Âblock/cfq-iosched.c | Â Â9 +++++++++
> Â1 file changed, 9 insertions(+)
>
> Index: linux/block/cfq-iosched.c
> ===================================================================
> --- linux.orig/block/cfq-iosched.c   Â2011-01-11 16:24:56.000000000 +0800
> +++ linux/block/cfq-iosched.c  2011-01-11 16:41:49.000000000 +0800
> @@ -3284,10 +3284,19 @@ cfq_should_preempt(struct cfq_data *cfqd
> Â*/
> Âstatic void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> Â{
> + Â Â Â struct cfq_queue *old_cfqq = cfqd->active_queue;
> +
> Â Â Â Âcfq_log_cfqq(cfqd, cfqq, "preempt");
> Â Â Â Âcfq_slice_expired(cfqd, 1);
>
> Â Â Â Â/*
> + Â Â Â Â* workload type is changed, don't save slice, otherwise preempt
> + Â Â Â Â* doesn't happen
> + Â Â Â Â*/
> + Â Â Â if (cfqq_type(old_cfqq) != cfqq_type(cfqq))
> + Â Â Â Â Â Â Â cfqq->cfqg->saved_workload_slice = 0;
> +
> + Â Â Â /*
> Â Â Â Â * Put the new queue at the front of the of the current list,
> Â Â Â Â * so we know that it will be selected next.
> Â Â Â Â */
>
>
>
--
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/