From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: vgoyal@redhat.com, ctalbott@google.com, rni@google.com,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
containers@lists.linux-foundation.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 10/11] blkcg: drop stuff unused after per-queue policy activation update
Date: Fri, 13 Apr 2012 13:11:34 -0700 [thread overview]
Message-ID: <1334347895-6268-11-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1334347895-6268-1-git-send-email-tj@kernel.org>
* All_q_list is unused. Drop all_q_{mutex|list}.
* @for_root of blkg_lookup_create() is always %false when called from
outside blk-cgroup.c proper. Factor out __blkg_lookup_create() so
that it doesn't check whether @q is bypassing and use the
underscored version for the @for_root callsite.
* blkg_destroy_all() is used only from blkcg proper and @destroy_root
is always %true. Make it static and drop @destroy_root.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
---
block/blk-cgroup.c | 61 ++++++++++++++++---------------------------------
block/blk-cgroup.h | 6 +----
block/blk-throttle.c | 2 +-
block/cfq-iosched.c | 2 +-
4 files changed, 23 insertions(+), 48 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index d6d59ad..10f0d2f 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -25,8 +25,6 @@
#define MAX_KEY_LEN 100
static DEFINE_MUTEX(blkcg_pol_mutex);
-static DEFINE_MUTEX(all_q_mutex);
-static LIST_HEAD(all_q_list);
struct blkio_cgroup blkio_root_cgroup = { .cfq_weight = 2 * CFQ_WEIGHT_DEFAULT };
EXPORT_SYMBOL_GPL(blkio_root_cgroup);
@@ -179,9 +177,8 @@ struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
}
EXPORT_SYMBOL_GPL(blkg_lookup);
-struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
- struct request_queue *q,
- bool for_root)
+static struct blkio_group *__blkg_lookup_create(struct blkio_cgroup *blkcg,
+ struct request_queue *q)
__releases(q->queue_lock) __acquires(q->queue_lock)
{
struct blkio_group *blkg;
@@ -189,13 +186,6 @@ struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
WARN_ON_ONCE(!rcu_read_lock_held());
lockdep_assert_held(q->queue_lock);
- /*
- * This could be the first entry point of blkcg implementation and
- * we shouldn't allow anything to go through for a bypassing queue.
- */
- if (unlikely(blk_queue_bypass(q)) && !for_root)
- return ERR_PTR(blk_queue_dead(q) ? -EINVAL : -EBUSY);
-
blkg = __blkg_lookup(blkcg, q);
if (blkg)
return blkg;
@@ -223,6 +213,18 @@ struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
out:
return blkg;
}
+
+struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
+ struct request_queue *q)
+{
+ /*
+ * This could be the first entry point of blkcg implementation and
+ * we shouldn't allow anything to go through for a bypassing queue.
+ */
+ if (unlikely(blk_queue_bypass(q)))
+ return ERR_PTR(blk_queue_dead(q) ? -EINVAL : -EBUSY);
+ return __blkg_lookup_create(blkcg, q);
+}
EXPORT_SYMBOL_GPL(blkg_lookup_create);
static void blkg_destroy(struct blkio_group *blkg)
@@ -249,12 +251,10 @@ static void blkg_destroy(struct blkio_group *blkg)
/**
* blkg_destroy_all - destroy all blkgs associated with a request_queue
* @q: request_queue of interest
- * @destroy_root: whether to destroy root blkg or not
*
- * Destroy blkgs associated with @q. If @destroy_root is %true, all are
- * destroyed; otherwise, root blkg is left alone.
+ * Destroy all blkgs associated with @q.
*/
-void blkg_destroy_all(struct request_queue *q, bool destroy_root)
+static void blkg_destroy_all(struct request_queue *q)
{
struct blkio_group *blkg, *n;
@@ -263,10 +263,6 @@ void blkg_destroy_all(struct request_queue *q, bool destroy_root)
list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) {
struct blkio_cgroup *blkcg = blkg->blkcg;
- /* skip root? */
- if (!destroy_root && blkg->blkcg == &blkio_root_cgroup)
- continue;
-
spin_lock(&blkcg->lock);
blkg_destroy(blkg);
spin_unlock(&blkcg->lock);
@@ -274,7 +270,6 @@ void blkg_destroy_all(struct request_queue *q, bool destroy_root)
spin_unlock_irq(q->queue_lock);
}
-EXPORT_SYMBOL_GPL(blkg_destroy_all);
static void blkg_rcu_free(struct rcu_head *rcu_head)
{
@@ -492,7 +487,7 @@ int blkg_conf_prep(struct blkio_cgroup *blkcg,
spin_lock_irq(disk->queue->queue_lock);
if (blkcg_policy_enabled(disk->queue, pol))
- blkg = blkg_lookup_create(blkcg, disk->queue, false);
+ blkg = blkg_lookup_create(blkcg, disk->queue);
else
blkg = ERR_PTR(-EINVAL);
@@ -625,20 +620,9 @@ done:
*/
int blkcg_init_queue(struct request_queue *q)
{
- int ret;
-
might_sleep();
- ret = blk_throtl_init(q);
- if (ret)
- return ret;
-
- mutex_lock(&all_q_mutex);
- INIT_LIST_HEAD(&q->all_q_node);
- list_add_tail(&q->all_q_node, &all_q_list);
- mutex_unlock(&all_q_mutex);
-
- return 0;
+ return blk_throtl_init(q);
}
/**
@@ -662,12 +646,7 @@ void blkcg_drain_queue(struct request_queue *q)
*/
void blkcg_exit_queue(struct request_queue *q)
{
- mutex_lock(&all_q_mutex);
- list_del_init(&q->all_q_node);
- mutex_unlock(&all_q_mutex);
-
- blkg_destroy_all(q, true);
-
+ blkg_destroy_all(q);
blk_throtl_exit(q);
}
@@ -741,7 +720,7 @@ int blkcg_activate_policy(struct request_queue *q,
spin_lock_irq(q->queue_lock);
rcu_read_lock();
- blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
+ blkg = __blkg_lookup_create(&blkio_root_cgroup, q);
rcu_read_unlock();
if (IS_ERR(blkg)) {
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 66253a7..222063d 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -115,7 +115,6 @@ extern int blkcg_activate_policy(struct request_queue *q,
const struct blkio_policy_type *pol);
extern void blkcg_deactivate_policy(struct request_queue *q,
const struct blkio_policy_type *pol);
-extern void blkg_destroy_all(struct request_queue *q, bool destroy_root);
void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
u64 (*prfill)(struct seq_file *, void *, int),
@@ -334,8 +333,6 @@ static inline int blkcg_activate_policy(struct request_queue *q,
const struct blkio_policy_type *pol) { return 0; }
static inline void blkcg_deactivate_policy(struct request_queue *q,
const struct blkio_policy_type *pol) { }
-static inline void blkg_destroy_all(struct request_queue *q,
- bool destory_root) { }
static inline void *blkg_to_pdata(struct blkio_group *blkg,
struct blkio_policy_type *pol) { return NULL; }
@@ -354,8 +351,7 @@ extern struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio);
extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg,
struct request_queue *q);
struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg,
- struct request_queue *q,
- bool for_root);
+ struct request_queue *q);
#else
struct cgroup;
static inline struct blkio_cgroup *
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 2fc964e..e2aaf27 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -285,7 +285,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
} else {
struct blkio_group *blkg;
- blkg = blkg_lookup_create(blkcg, q, false);
+ blkg = blkg_lookup_create(blkcg, q);
/* if %NULL and @q is alive, fall back to root_tg */
if (!IS_ERR(blkg))
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0203652..eb07eb6 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1348,7 +1348,7 @@ static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd,
} else {
struct blkio_group *blkg;
- blkg = blkg_lookup_create(blkcg, q, false);
+ blkg = blkg_lookup_create(blkcg, q);
if (!IS_ERR(blkg))
cfqg = blkg_to_cfqg(blkg);
}
--
1.7.7.3
next prev parent reply other threads:[~2012-04-13 20:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 20:11 [PATCHSET] block: per-queue policy activation, take#2 Tejun Heo
2012-04-13 20:11 ` [PATCH 01/11] cfq: fix build breakage & warnings Tejun Heo
2012-04-13 20:11 ` [PATCH 02/11] blkcg: kill blkio_list and replace blkio_list_lock with a mutex Tejun Heo
2012-04-13 20:11 ` [PATCH 03/11] blkcg: use @pol instead of @plid in update_root_blkg_pd() and blkcg_print_blkgs() Tejun Heo
2012-04-13 20:11 ` [PATCH 04/11] blkcg: remove static policy ID enums Tejun Heo
2012-04-13 20:11 ` [PATCH 05/11] blkcg: make blkg_conf_prep() take @pol and return with queue lock held Tejun Heo
2012-04-13 20:11 ` [PATCH 06/11] blkcg: make sure blkg_lookup() returns %NULL if @q is bypassing Tejun Heo
2012-04-13 21:50 ` [PATCH UPDATED " Tejun Heo
2012-04-13 20:11 ` [PATCH 07/11] blkcg: make request_queue bypassing on allocation Tejun Heo
2012-04-13 20:32 ` Vivek Goyal
2012-04-13 20:37 ` Tejun Heo
2012-04-13 20:44 ` Vivek Goyal
2012-04-13 20:47 ` Tejun Heo
2012-04-13 20:55 ` Vivek Goyal
2012-04-13 21:05 ` Tejun Heo
2012-04-13 21:16 ` Tejun Heo
2012-04-13 21:31 ` Tejun Heo
2012-04-17 12:04 ` James Bottomley
2012-04-18 21:42 ` Tejun Heo
2012-04-13 21:33 ` Vivek Goyal
2012-04-13 21:38 ` Tejun Heo
2012-04-16 12:39 ` Vivek Goyal
2012-04-13 20:37 ` Vivek Goyal
2012-04-13 20:11 ` [PATCH 08/11] blkcg: add request_queue->root_blkg Tejun Heo
2012-04-13 20:11 ` [PATCH 09/11] blkcg: implement per-queue policy activation Tejun Heo
2012-04-13 20:11 ` Tejun Heo [this message]
2012-04-13 20:11 ` [PATCH 11/11] blkcg: shoot down blkgs if all policies are deactivated Tejun Heo
2012-04-20 8:09 ` [PATCHSET] block: per-queue policy activation, take#2 Jens Axboe
2012-04-20 12:02 ` Jens Axboe
2012-04-20 17:17 ` Tejun Heo
2012-04-20 19:08 ` Jens Axboe
2012-04-25 18:19 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334347895-6268-11-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=containers@lists.linux-foundation.org \
--cc=ctalbott@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rni@google.com \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).