Commit bb729bc9 authored by Jens Axboe's avatar Jens Axboe

cfq-iosched: use call_rcu() instead of doing grace period stall on queue exit

After the merge of the IO controller patches, booting on my megaraid
box ran much slower. Vivek Goyal traced it down to megaraid discovery
creating tons of devices, each suffering a grace period when they later
kill that queue (if no device is found).

So lets use call_rcu() to batch these deferred frees, instead of taking
the grace period hit for each one.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 846954b0
...@@ -287,6 +287,7 @@ struct cfq_data { ...@@ -287,6 +287,7 @@ struct cfq_data {
/* List of cfq groups being managed on this device*/ /* List of cfq groups being managed on this device*/
struct hlist_head cfqg_list; struct hlist_head cfqg_list;
struct rcu_head rcu;
}; };
static struct cfq_group *cfq_get_next_cfqg(struct cfq_data *cfqd); static struct cfq_group *cfq_get_next_cfqg(struct cfq_data *cfqd);
...@@ -3601,6 +3602,11 @@ static void cfq_put_async_queues(struct cfq_data *cfqd) ...@@ -3601,6 +3602,11 @@ static void cfq_put_async_queues(struct cfq_data *cfqd)
cfq_put_queue(cfqd->async_idle_cfqq); cfq_put_queue(cfqd->async_idle_cfqq);
} }
static void cfq_cfqd_free(struct rcu_head *head)
{
kfree(container_of(head, struct cfq_data, rcu));
}
static void cfq_exit_queue(struct elevator_queue *e) static void cfq_exit_queue(struct elevator_queue *e)
{ {
struct cfq_data *cfqd = e->elevator_data; struct cfq_data *cfqd = e->elevator_data;
...@@ -3630,8 +3636,7 @@ static void cfq_exit_queue(struct elevator_queue *e) ...@@ -3630,8 +3636,7 @@ static void cfq_exit_queue(struct elevator_queue *e)
cfq_shutdown_timer_wq(cfqd); cfq_shutdown_timer_wq(cfqd);
/* Wait for cfqg->blkg->key accessors to exit their grace periods. */ /* Wait for cfqg->blkg->key accessors to exit their grace periods. */
synchronize_rcu(); call_rcu(&cfqd->rcu, cfq_cfqd_free);
kfree(cfqd);
} }
static void *cfq_init_queue(struct request_queue *q) static void *cfq_init_queue(struct request_queue *q)
...@@ -3706,6 +3711,7 @@ static void *cfq_init_queue(struct request_queue *q) ...@@ -3706,6 +3711,7 @@ static void *cfq_init_queue(struct request_queue *q)
cfqd->cfq_group_isolation = 0; cfqd->cfq_group_isolation = 0;
cfqd->hw_tag = -1; cfqd->hw_tag = -1;
cfqd->last_end_sync_rq = jiffies; cfqd->last_end_sync_rq = jiffies;
INIT_RCU_HEAD(&cfqd->rcu);
return cfqd; return cfqd;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment