Re: [PATCH 7/8] cfq-iosched: fold cfq_find_alloc_queue() into cfq_get_queue()

From: Tejun Heo
Date: Tue Jun 09 2015 - 22:47:47 EST


Hey, Jeff.

On Tue, Jun 09, 2015 at 10:40:02AM -0400, Jeff Moyer wrote:
> The resulting code (introduced by the last patch, I know) is not ideal:
>
> rcu_read_lock();
> cfqg = cfq_lookup_create_cfqg(cfqd, bio_blkcg(bio));
> if (!cfqg) {
> cfqq = &cfqd->oom_cfqq;
> goto out;
> }
>
> if (!is_sync) {
> if (!ioprio_valid(cic->ioprio)) {
> struct task_struct *tsk = current;
> ioprio = task_nice_ioprio(tsk);
> ioprio_class = task_nice_ioclass(tsk);
> }
> async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class,
> ioprio);
> cfqq = *async_cfqq;
> if (cfqq)
> goto out;
> }
>
> As you mentioned, we don't need to lookup the cfqg for the async queue.
> What's more is we could fallback to the oom_cfqq even if we had an
> existing async cfqq. I'm guessing you structured the code this way to
> make the error path cleaner. I don't think it's a big deal, as it
> should be a rare occurrence, so...

In this patch, the lookup seems unnecessary for the async case but the
change is required for the following changes because async queues are
moved from cfq_data to cfq_group, so we can't determine async queues
w/o looking up cfqg at all and we'll have to fall back to oom_cfqq if
cfqg lookup fails (cuz there's no system-wide async queues).

Thanks.

--
tejun
--
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/