Re: [PATCH 05/18] io-controller: Common hierarchical fair queuingcode in elevaotor layer

From: Li Zefan
Date: Thu May 07 2009 - 04:04:41 EST


Gui Jianfeng wrote:
> Vivek Goyal wrote:
>> This patch enables hierarchical fair queuing in common layer. It is
>> controlled by config option CONFIG_GROUP_IOSCHED.
> ...
>> +}
>> +
>> +void iocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup)
>> +{
>> + struct io_cgroup *iocg = cgroup_to_io_cgroup(cgroup);
>> + struct hlist_node *n, *tmp;
>> + struct io_group *iog;
>> +
>> + /*
>> + * Since we are destroying the cgroup, there are no more tasks
>> + * referencing it, and all the RCU grace periods that may have
>> + * referenced it are ended (as the destruction of the parent
>> + * cgroup is RCU-safe); bgrp->group_data will not be accessed by
>> + * anything else and we don't need any synchronization.
>> + */
>> + hlist_for_each_entry_safe(iog, n, tmp, &iocg->group_data, group_node)
>> + io_destroy_group(iocg, iog);
>> +
>> + BUG_ON(!hlist_empty(&iocg->group_data));
>> +
>
> Hi Vivek,
>
> IMHO, free_css_id() needs to be called here.
>

Right.

Though alloc_css_id() is called by cgroup core in cgroup_create(),
free_css_id() should be called by subsystem itself.

This is a bit strange, but it's required by memory cgroup. Normally,
free_css_id() is called in destroy() handler, but memcg calls it
when a mem_cgroup's refcnt goes to 0. When a cgroup is destroyed,
the mem_cgroup won't be destroyed (refcnt > 0) if it has records on
swap-entry.

>> + kfree(iocg);
>> +}
>> +
>> +void io_disconnect_groups(struct elevator_queue *e)
>> +{
>> + struct hlist_node *pos, *n;
>> + struct io_group *iog;
>> + struct elv_fq_data *efqd = &e->efqd;
>> +
>> + hlist_for_each_entry_safe(iog, pos, n, &efqd->group_list,
>> + elv_data_node) {
>> + hlist_del(&iog->elv_data_node);
>> +
>

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