2010-04-16 04:02:53

by Divyesh Shah

[permalink] [raw]
Subject: [PATCH] blkio: Initialize blkg->stats_lock for the root cfqg too

This fixes the lockdep warning reported by Gui Jianfeng.

Signed-off-by: Divyesh Shah <[email protected]>
---

block/blk-cgroup.c | 7 +------
block/blk-cgroup.h | 2 --
block/cfq-iosched.c | 1 -
3 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 80c1261..83930f6 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -86,12 +86,6 @@ struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
}
EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);

-void blkio_group_init(struct blkio_group *blkg)
-{
- spin_lock_init(&blkg->stats_lock);
-}
-EXPORT_SYMBOL_GPL(blkio_group_init);
-
/*
* Add to the appropriate stat variable depending on the request type.
* This should be called with the blkg->stats_lock held.
@@ -349,6 +343,7 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
unsigned long flags;

spin_lock_irqsave(&blkcg->lock, flags);
+ spin_lock_init(&blkg->stats_lock);
rcu_assign_pointer(blkg->key, key);
blkg->blkcg_id = css_id(&blkcg->css);
hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 1d409ad..2c956a0 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -217,7 +217,6 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
void *key);
-void blkio_group_init(struct blkio_group *blkg);
void blkiocg_update_timeslice_used(struct blkio_group *blkg,
unsigned long time);
void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes,
@@ -235,7 +234,6 @@ struct cgroup;
static inline struct blkio_cgroup *
cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }

-static inline void blkio_group_init(struct blkio_group *blkg) {}
static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
struct blkio_group *blkg, void *key, dev_t dev) {}

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0177109..62defd0 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -961,7 +961,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
for_each_cfqg_st(cfqg, i, j, st)
*st = CFQ_RB_ROOT;
RB_CLEAR_NODE(&cfqg->rb_node);
- blkio_group_init(&cfqg->blkg);

/*
* Take the initial reference that will be released on destroy


2010-04-16 04:20:56

by Gui, Jianfeng/归 剑峰

[permalink] [raw]
Subject: Re: [PATCH] blkio: Initialize blkg->stats_lock for the root cfqg too

Divyesh Shah wrote:
> This fixes the lockdep warning reported by Gui Jianfeng.
>
> Signed-off-by: Divyesh Shah <[email protected]>

This patch looks good to me.
Reviewed-by: Gui Jianfeng <[email protected]>

> ---
>
> block/blk-cgroup.c | 7 +------
> block/blk-cgroup.h | 2 --
> block/cfq-iosched.c | 1 -
> 3 files changed, 1 insertions(+), 9 deletions(-)
>
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 80c1261..83930f6 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -86,12 +86,6 @@ struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
> }
> EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);
>
> -void blkio_group_init(struct blkio_group *blkg)
> -{
> - spin_lock_init(&blkg->stats_lock);
> -}
> -EXPORT_SYMBOL_GPL(blkio_group_init);
> -
> /*
> * Add to the appropriate stat variable depending on the request type.
> * This should be called with the blkg->stats_lock held.
> @@ -349,6 +343,7 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> unsigned long flags;
>
> spin_lock_irqsave(&blkcg->lock, flags);
> + spin_lock_init(&blkg->stats_lock);
> rcu_assign_pointer(blkg->key, key);
> blkg->blkcg_id = css_id(&blkcg->css);
> hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
> diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
> index 1d409ad..2c956a0 100644
> --- a/block/blk-cgroup.h
> +++ b/block/blk-cgroup.h
> @@ -217,7 +217,6 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
> extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
> void *key);
> -void blkio_group_init(struct blkio_group *blkg);
> void blkiocg_update_timeslice_used(struct blkio_group *blkg,
> unsigned long time);
> void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes,
> @@ -235,7 +234,6 @@ struct cgroup;
> static inline struct blkio_cgroup *
> cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
>
> -static inline void blkio_group_init(struct blkio_group *blkg) {}
> static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> struct blkio_group *blkg, void *key, dev_t dev) {}
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 0177109..62defd0 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -961,7 +961,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
> for_each_cfqg_st(cfqg, i, j, st)
> *st = CFQ_RB_ROOT;
> RB_CLEAR_NODE(&cfqg->rb_node);
> - blkio_group_init(&cfqg->blkg);
>
> /*
> * Take the initial reference that will be released on destroy
>
>
>
>

--
Regards
Gui Jianfeng

2010-04-16 06:07:06

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] blkio: Initialize blkg->stats_lock for the root cfqg too

On Thu, Apr 15 2010, Divyesh Shah wrote:
> This fixes the lockdep warning reported by Gui Jianfeng.

Thanks, applied.

--
Jens Axboe

2010-04-16 13:18:23

by Vivek Goyal

[permalink] [raw]
Subject: Re: [PATCH] blkio: Initialize blkg->stats_lock for the root cfqg too

On Thu, Apr 15, 2010 at 09:02:22PM -0700, Divyesh Shah wrote:
> This fixes the lockdep warning reported by Gui Jianfeng.
>
> Signed-off-by: Divyesh Shah <[email protected]>
> ---

This looks good.

Acked-by: Vivek Goyal <[email protected]>

Vivek

>
> block/blk-cgroup.c | 7 +------
> block/blk-cgroup.h | 2 --
> block/cfq-iosched.c | 1 -
> 3 files changed, 1 insertions(+), 9 deletions(-)
>
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 80c1261..83930f6 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -86,12 +86,6 @@ struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
> }
> EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);
>
> -void blkio_group_init(struct blkio_group *blkg)
> -{
> - spin_lock_init(&blkg->stats_lock);
> -}
> -EXPORT_SYMBOL_GPL(blkio_group_init);
> -
> /*
> * Add to the appropriate stat variable depending on the request type.
> * This should be called with the blkg->stats_lock held.
> @@ -349,6 +343,7 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> unsigned long flags;
>
> spin_lock_irqsave(&blkcg->lock, flags);
> + spin_lock_init(&blkg->stats_lock);
> rcu_assign_pointer(blkg->key, key);
> blkg->blkcg_id = css_id(&blkcg->css);
> hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
> diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
> index 1d409ad..2c956a0 100644
> --- a/block/blk-cgroup.h
> +++ b/block/blk-cgroup.h
> @@ -217,7 +217,6 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
> extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
> void *key);
> -void blkio_group_init(struct blkio_group *blkg);
> void blkiocg_update_timeslice_used(struct blkio_group *blkg,
> unsigned long time);
> void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes,
> @@ -235,7 +234,6 @@ struct cgroup;
> static inline struct blkio_cgroup *
> cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
>
> -static inline void blkio_group_init(struct blkio_group *blkg) {}
> static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> struct blkio_group *blkg, void *key, dev_t dev) {}
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 0177109..62defd0 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -961,7 +961,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
> for_each_cfqg_st(cfqg, i, j, st)
> *st = CFQ_RB_ROOT;
> RB_CLEAR_NODE(&cfqg->rb_node);
> - blkio_group_init(&cfqg->blkg);
>
> /*
> * Take the initial reference that will be released on destroy