Re: [PATCH] cfq: Remove useless css reference get

From: Corrado Zoccolo
Date: Wed Dec 16 2009 - 06:09:19 EST


Hi Gui,
maybe you can add a comment that cfq_find_alloc_cfqg can now be called
only under rcu_read_lock().

On Wed, Dec 16, 2009 at 9:38 AM, Gui Jianfeng
<guijianfeng@xxxxxxxxxxxxxx> wrote:
> There's no need to take css reference here, for the caller
> has already called rcu_read_lock() to prevent cgroup from
> being removed.
>
> Signed-off-by: Gui Jianfeng <guijianfeng@xxxxxxxxxxxxxx>
> Reviewed-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
> ---
> Âblock/blk-cgroup.c Â| Â 14 --------------
> Âblock/blk-cgroup.h Â| Â Â3 ---
> Âblock/cfq-iosched.c | Â Â5 -----
> Â3 files changed, 0 insertions(+), 22 deletions(-)
>
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 1fa2654..cba28f4 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -23,20 +23,6 @@ static LIST_HEAD(blkio_list);
> Âstruct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT };
> ÂEXPORT_SYMBOL_GPL(blkio_root_cgroup);
>
> -bool blkiocg_css_tryget(struct blkio_cgroup *blkcg)
> -{
> - Â Â Â if (!css_tryget(&blkcg->css))
> - Â Â Â Â Â Â Â return false;
> - Â Â Â return true;
> -}
> -EXPORT_SYMBOL_GPL(blkiocg_css_tryget);
> -
> -void blkiocg_css_put(struct blkio_cgroup *blkcg)
> -{
> - Â Â Â css_put(&blkcg->css);
> -}
> -EXPORT_SYMBOL_GPL(blkiocg_css_put);
> -
> Âstruct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
> Â{
> Â Â Â Âreturn container_of(cgroup_subsys_state(cgroup, blkio_subsys_id),
> diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
> index 4d316df..84bf745 100644
> --- a/block/blk-cgroup.h
> +++ b/block/blk-cgroup.h
> @@ -43,9 +43,6 @@ struct blkio_group {
> Â Â Â Âunsigned long sectors;
> Â};
>
> -extern bool blkiocg_css_tryget(struct blkio_cgroup *blkcg);
> -extern void blkiocg_css_put(struct blkio_cgroup *blkcg);
> -
> Âtypedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg);
> Âtypedef void (blkio_update_group_weight_fn) (struct blkio_group *blkg,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned int weight);
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index e2f8046..5d6b427 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -958,10 +958,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
> Â Â Â Âstruct backing_dev_info *bdi = &cfqd->queue->backing_dev_info;
> Â Â Â Âunsigned int major, minor;
>
> - Â Â Â /* Do we need to take this reference */
> - Â Â Â if (!blkiocg_css_tryget(blkcg))
> - Â Â Â Â Â Â Â return NULL;;
> -
> Â Â Â Âcfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key));
> Â Â Â Âif (cfqg || !create)
> Â Â Â Â Â Â Â Âgoto done;
> @@ -992,7 +988,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
> Â Â Â Âhlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list);
>
> Âdone:
> - Â Â Â blkiocg_css_put(blkcg);
> Â Â Â Âreturn cfqg;
> Â}
>
> --
> 1.5.4.rc3

Thanks,
Corrado
--
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/