Re: [RFC PATCH 3/5] cfq-iosched: reimplement priorities using different service trees

From: Corrado Zoccolo
Date: Tue Oct 20 2009 - 06:43:34 EST


On Tue, Oct 20, 2009 at 2:58 AM, Jens Axboe <jens.axboe@xxxxxxxxxx> wrote:
> On Mon, Oct 19 2009, Corrado Zoccolo wrote:
>> We use different service trees for different priority classes.
>> This allows a simplification in the service tree insertion code, that no
>> longer has to consider priority while walking the tree.
>
>> +enum wl_prio_t {
>> + Â Â IDLE_WL = -1,
>> + Â Â BE_WL = 0,
>> + Â Â RT_WL = 1
>> +};
>
> WL?
It stands for "workload". When defining all-caps constants, one has to
avoid possible clashes adding pre/suf-fixes.
Any suggestion for better naming?
>
>> +static struct cfq_rb_root *service_tree_for(enum wl_prio_t prio,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct cfq_data *cfqd)
>> +{
>> + Â Â return prio == IDLE_WL ? &cfqd->service_tree_idle :
>> + Â Â Â Â Â Â &cfqd->service_trees[prio];
>> +}
>
> Don't do it...
>
> static struct cfq_rb_root *service_tree_for(enum wl_prio_t prio,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âstruct cfq_data *cfqd)
> {
> Â Â Â Âif (prio == IDLE_WL)
> Â Â Â Â Â Â Â Âreturn &cfqd->service_tree_idle;
>
> Â Â Â Âreturn &cfqd->service_trees[prio];
> }
>
> much cleaner. There are more of these in this patch.
I don't see much difference: my brain just translates the former in
the latter, and the former takes up less screen space.
But you are the maintainer, so I'll write it as you want.

> Otherwise it looks sane, and I agree that making the insert cleaner here
> is a good bonus.

Thanks
Corrado
>
> --
> Jens Axboe
>
>
--
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/