[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F040BA7.9070203@lge.com>
Date: Wed, 04 Jan 2012 17:19:51 +0900
From: Namhyung Kim <namhyung.kim@....com>
To: shaohua.li@...el.com
CC: linux-kernel@...r.kernel.org, axboe@...nel.dk, vgoyal@...hat.com,
jmoyer@...hat.com
Subject: Re: [RFC 1/3]block: seperate CFQ io context management code
Hi,
Two of nitpicks below ..
2012-01-04 3:53 PM, Shaohua Li Wrote:
> CFQ's io context management creates a per-device io context for each task.
> It's quite generic. Separate it from CFQ, and use it for fiops I/O scheduler.
>
> Signed-off-by: Shaohua Li<shaohua.li@...el.com>
> ---
[snip]
> +int ioc_builder_init(struct ioc_builder *builder)
> +{
> + if (!builder->alloc_ioc || !builder->free_ioc)
> + return -ENOMEM;
> +
> + builder->ioc_count = alloc_percpu(unsigned long);
> + if (!builder->ioc_count)
> + return -ENOMEM;
> +
> + builder->ioc_gone = NULL;
> + spin_lock_init(&builder->ioc_gone_lock);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(ioc_builder_init);
> +
> +void io_context_builder_exit(struct ioc_builder *builder)
It'd be better using 'ioc_builder_exit' as a name for consistency, IMHO.
> +{
> + DECLARE_COMPLETION_ONSTACK(all_gone);
> +
> + builder->ioc_gone =&all_gone;
> + /* ioc_gone's update must be visible before reading ioc_count */
> + smp_wmb();
> +
> + /*
> + * this also protects us from entering cfq_slab_kill() with
> + * pending RCU callbacks
> + */
> + if (elv_ioc_count_read(*builder->ioc_count))
> + wait_for_completion(&all_gone);
> +
> + free_percpu(builder->ioc_count);
> +}
> +EXPORT_SYMBOL(io_context_builder_exit);
[snip]
> +static void queue_data_cic_free_rcu(struct rcu_head *head)
> +{
> + struct dev_io_context *cic;
> + struct ioc_builder *builder;
> +
> + cic = container_of(head, struct dev_io_context, rcu_head);
> + builder = cic->builder;
> +
> + builder->free_ioc(builder, cic);
> + elv_ioc_count_dec(*builder->ioc_count);
> +
> + if (builder->ioc_gone) {
> + /*
> + * CFQ scheduler is exiting, grab exit lock and check
s/CFQ/IO/ ?
Thanks.
Namhyung Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists