diff options
author | Divyesh Shah <dpshah@google.com> | 2010-04-13 13:59:17 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-04-13 13:59:17 -0400 |
commit | a11cdaa7af56423a921a8bdad8f5a5f4ddca918a (patch) | |
tree | 45309d760ab80347d4ad5a2cd249c988a507c636 | |
parent | da69da184c06f365b335a0e013dc6360a82abe85 (diff) |
block: Update to io-controller stats
Changelog from v1:
o Call blkiocg_update_idle_time_stats() at cfq_rq_enqueued() instead of at
dispatch time.
Changelog from original patchset: (in response to Vivek Goyal's comments)
o group blkiocg_update_blkio_group_dequeue_stats() with other DEBUG functions
o rename blkiocg_update_set_active_queue_stats() to
blkiocg_update_avg_queue_size_stats()
o s/request/io/ in blkiocg_update_request_add_stats() and
blkiocg_update_request_remove_stats()
o Call cfq_del_timer() at request dispatch() instead of
blkiocg_update_idle_time_stats()
Signed-off-by: Divyesh Shah<dpshah@google.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/blk-cgroup.c | 28 | ||||
-rw-r--r-- | block/blk-cgroup.h | 12 | ||||
-rw-r--r-- | block/cfq-iosched.c | 20 |
3 files changed, 28 insertions, 32 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 649b05d7f291..25cc7514d817 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -202,7 +202,7 @@ void blkiocg_update_idle_time_stats(struct blkio_group *blkg) | |||
202 | } | 202 | } |
203 | EXPORT_SYMBOL_GPL(blkiocg_update_idle_time_stats); | 203 | EXPORT_SYMBOL_GPL(blkiocg_update_idle_time_stats); |
204 | 204 | ||
205 | void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg) | 205 | void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg) |
206 | { | 206 | { |
207 | unsigned long flags; | 207 | unsigned long flags; |
208 | struct blkio_group_stats *stats; | 208 | struct blkio_group_stats *stats; |
@@ -216,14 +216,21 @@ void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg) | |||
216 | blkio_update_group_wait_time(stats); | 216 | blkio_update_group_wait_time(stats); |
217 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 217 | spin_unlock_irqrestore(&blkg->stats_lock, flags); |
218 | } | 218 | } |
219 | EXPORT_SYMBOL_GPL(blkiocg_update_set_active_queue_stats); | 219 | EXPORT_SYMBOL_GPL(blkiocg_update_avg_queue_size_stats); |
220 | |||
221 | void blkiocg_update_dequeue_stats(struct blkio_group *blkg, | ||
222 | unsigned long dequeue) | ||
223 | { | ||
224 | blkg->stats.dequeue += dequeue; | ||
225 | } | ||
226 | EXPORT_SYMBOL_GPL(blkiocg_update_dequeue_stats); | ||
220 | #else | 227 | #else |
221 | static inline void blkio_set_start_group_wait_time(struct blkio_group *blkg, | 228 | static inline void blkio_set_start_group_wait_time(struct blkio_group *blkg, |
222 | struct blkio_group *curr_blkg) {} | 229 | struct blkio_group *curr_blkg) {} |
223 | static inline void blkio_end_empty_time(struct blkio_group_stats *stats) {} | 230 | static inline void blkio_end_empty_time(struct blkio_group_stats *stats) {} |
224 | #endif | 231 | #endif |
225 | 232 | ||
226 | void blkiocg_update_request_add_stats(struct blkio_group *blkg, | 233 | void blkiocg_update_io_add_stats(struct blkio_group *blkg, |
227 | struct blkio_group *curr_blkg, bool direction, | 234 | struct blkio_group *curr_blkg, bool direction, |
228 | bool sync) | 235 | bool sync) |
229 | { | 236 | { |
@@ -236,9 +243,9 @@ void blkiocg_update_request_add_stats(struct blkio_group *blkg, | |||
236 | blkio_set_start_group_wait_time(blkg, curr_blkg); | 243 | blkio_set_start_group_wait_time(blkg, curr_blkg); |
237 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 244 | spin_unlock_irqrestore(&blkg->stats_lock, flags); |
238 | } | 245 | } |
239 | EXPORT_SYMBOL_GPL(blkiocg_update_request_add_stats); | 246 | EXPORT_SYMBOL_GPL(blkiocg_update_io_add_stats); |
240 | 247 | ||
241 | void blkiocg_update_request_remove_stats(struct blkio_group *blkg, | 248 | void blkiocg_update_io_remove_stats(struct blkio_group *blkg, |
242 | bool direction, bool sync) | 249 | bool direction, bool sync) |
243 | { | 250 | { |
244 | unsigned long flags; | 251 | unsigned long flags; |
@@ -248,7 +255,7 @@ void blkiocg_update_request_remove_stats(struct blkio_group *blkg, | |||
248 | direction, sync); | 255 | direction, sync); |
249 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 256 | spin_unlock_irqrestore(&blkg->stats_lock, flags); |
250 | } | 257 | } |
251 | EXPORT_SYMBOL_GPL(blkiocg_update_request_remove_stats); | 258 | EXPORT_SYMBOL_GPL(blkiocg_update_io_remove_stats); |
252 | 259 | ||
253 | void blkiocg_update_timeslice_used(struct blkio_group *blkg, unsigned long time) | 260 | void blkiocg_update_timeslice_used(struct blkio_group *blkg, unsigned long time) |
254 | { | 261 | { |
@@ -636,15 +643,6 @@ SHOW_FUNCTION_PER_GROUP(empty_time, BLKIO_STAT_EMPTY_TIME, 0); | |||
636 | #endif | 643 | #endif |
637 | #undef SHOW_FUNCTION_PER_GROUP | 644 | #undef SHOW_FUNCTION_PER_GROUP |
638 | 645 | ||
639 | #ifdef CONFIG_DEBUG_BLK_CGROUP | ||
640 | void blkiocg_update_dequeue_stats(struct blkio_group *blkg, | ||
641 | unsigned long dequeue) | ||
642 | { | ||
643 | blkg->stats.dequeue += dequeue; | ||
644 | } | ||
645 | EXPORT_SYMBOL_GPL(blkiocg_update_dequeue_stats); | ||
646 | #endif | ||
647 | |||
648 | static int blkio_check_dev_num(dev_t dev) | 646 | static int blkio_check_dev_num(dev_t dev) |
649 | { | 647 | { |
650 | int part = 0; | 648 | int part = 0; |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 3c27bdfc97b9..1d409ad9c6e8 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -169,7 +169,7 @@ static inline char *blkg_path(struct blkio_group *blkg) | |||
169 | { | 169 | { |
170 | return blkg->path; | 170 | return blkg->path; |
171 | } | 171 | } |
172 | void blkiocg_update_set_active_queue_stats(struct blkio_group *blkg); | 172 | void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg); |
173 | void blkiocg_update_dequeue_stats(struct blkio_group *blkg, | 173 | void blkiocg_update_dequeue_stats(struct blkio_group *blkg, |
174 | unsigned long dequeue); | 174 | unsigned long dequeue); |
175 | void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg); | 175 | void blkiocg_update_set_idle_time_stats(struct blkio_group *blkg); |
@@ -198,7 +198,7 @@ BLKG_FLAG_FNS(empty) | |||
198 | #undef BLKG_FLAG_FNS | 198 | #undef BLKG_FLAG_FNS |
199 | #else | 199 | #else |
200 | static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } | 200 | static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } |
201 | static inline void blkiocg_update_set_active_queue_stats( | 201 | static inline void blkiocg_update_avg_queue_size_stats( |
202 | struct blkio_group *blkg) {} | 202 | struct blkio_group *blkg) {} |
203 | static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg, | 203 | static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg, |
204 | unsigned long dequeue) {} | 204 | unsigned long dequeue) {} |
@@ -226,9 +226,9 @@ void blkiocg_update_completion_stats(struct blkio_group *blkg, | |||
226 | uint64_t start_time, uint64_t io_start_time, bool direction, bool sync); | 226 | uint64_t start_time, uint64_t io_start_time, bool direction, bool sync); |
227 | void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, | 227 | void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, |
228 | bool sync); | 228 | bool sync); |
229 | void blkiocg_update_request_add_stats(struct blkio_group *blkg, | 229 | void blkiocg_update_io_add_stats(struct blkio_group *blkg, |
230 | struct blkio_group *curr_blkg, bool direction, bool sync); | 230 | struct blkio_group *curr_blkg, bool direction, bool sync); |
231 | void blkiocg_update_request_remove_stats(struct blkio_group *blkg, | 231 | void blkiocg_update_io_remove_stats(struct blkio_group *blkg, |
232 | bool direction, bool sync); | 232 | bool direction, bool sync); |
233 | #else | 233 | #else |
234 | struct cgroup; | 234 | struct cgroup; |
@@ -253,9 +253,9 @@ static inline void blkiocg_update_completion_stats(struct blkio_group *blkg, | |||
253 | bool sync) {} | 253 | bool sync) {} |
254 | static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg, | 254 | static inline void blkiocg_update_io_merged_stats(struct blkio_group *blkg, |
255 | bool direction, bool sync) {} | 255 | bool direction, bool sync) {} |
256 | static inline void blkiocg_update_request_add_stats(struct blkio_group *blkg, | 256 | static inline void blkiocg_update_io_add_stats(struct blkio_group *blkg, |
257 | struct blkio_group *curr_blkg, bool direction, bool sync) {} | 257 | struct blkio_group *curr_blkg, bool direction, bool sync) {} |
258 | static inline void blkiocg_update_request_remove_stats(struct blkio_group *blkg, | 258 | static inline void blkiocg_update_io_remove_stats(struct blkio_group *blkg, |
259 | bool direction, bool sync) {} | 259 | bool direction, bool sync) {} |
260 | #endif | 260 | #endif |
261 | #endif /* _BLK_CGROUP_H */ | 261 | #endif /* _BLK_CGROUP_H */ |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 91af2f2e59ce..42be3b68d356 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1381,10 +1381,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue *cfqq, struct request *rq) | |||
1381 | { | 1381 | { |
1382 | elv_rb_del(&cfqq->sort_list, rq); | 1382 | elv_rb_del(&cfqq->sort_list, rq); |
1383 | cfqq->queued[rq_is_sync(rq)]--; | 1383 | cfqq->queued[rq_is_sync(rq)]--; |
1384 | blkiocg_update_request_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq), | 1384 | blkiocg_update_io_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq), |
1385 | rq_is_sync(rq)); | 1385 | rq_is_sync(rq)); |
1386 | cfq_add_rq_rb(rq); | 1386 | cfq_add_rq_rb(rq); |
1387 | blkiocg_update_request_add_stats( | 1387 | blkiocg_update_io_add_stats( |
1388 | &cfqq->cfqg->blkg, &cfqq->cfqd->serving_group->blkg, | 1388 | &cfqq->cfqg->blkg, &cfqq->cfqd->serving_group->blkg, |
1389 | rq_data_dir(rq), rq_is_sync(rq)); | 1389 | rq_data_dir(rq), rq_is_sync(rq)); |
1390 | } | 1390 | } |
@@ -1442,7 +1442,7 @@ static void cfq_remove_request(struct request *rq) | |||
1442 | cfq_del_rq_rb(rq); | 1442 | cfq_del_rq_rb(rq); |
1443 | 1443 | ||
1444 | cfqq->cfqd->rq_queued--; | 1444 | cfqq->cfqd->rq_queued--; |
1445 | blkiocg_update_request_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq), | 1445 | blkiocg_update_io_remove_stats(&cfqq->cfqg->blkg, rq_data_dir(rq), |
1446 | rq_is_sync(rq)); | 1446 | rq_is_sync(rq)); |
1447 | if (rq_is_meta(rq)) { | 1447 | if (rq_is_meta(rq)) { |
1448 | WARN_ON(!cfqq->meta_pending); | 1448 | WARN_ON(!cfqq->meta_pending); |
@@ -1541,7 +1541,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd, | |||
1541 | if (cfqq) { | 1541 | if (cfqq) { |
1542 | cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d", | 1542 | cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d", |
1543 | cfqd->serving_prio, cfqd->serving_type); | 1543 | cfqd->serving_prio, cfqd->serving_type); |
1544 | blkiocg_update_set_active_queue_stats(&cfqq->cfqg->blkg); | 1544 | blkiocg_update_avg_queue_size_stats(&cfqq->cfqg->blkg); |
1545 | cfqq->slice_start = 0; | 1545 | cfqq->slice_start = 0; |
1546 | cfqq->dispatch_start = jiffies; | 1546 | cfqq->dispatch_start = jiffies; |
1547 | cfqq->allocated_slice = 0; | 1547 | cfqq->allocated_slice = 0; |
@@ -2395,11 +2395,6 @@ static int cfq_dispatch_requests(struct request_queue *q, int force) | |||
2395 | } | 2395 | } |
2396 | 2396 | ||
2397 | cfq_log_cfqq(cfqd, cfqq, "dispatched a request"); | 2397 | cfq_log_cfqq(cfqd, cfqq, "dispatched a request"); |
2398 | /* | ||
2399 | * This is needed since we don't exactly match the mod_timer() and | ||
2400 | * del_timer() calls in CFQ. | ||
2401 | */ | ||
2402 | blkiocg_update_idle_time_stats(&cfqq->cfqg->blkg); | ||
2403 | return 1; | 2398 | return 1; |
2404 | } | 2399 | } |
2405 | 2400 | ||
@@ -3208,8 +3203,11 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3208 | cfq_del_timer(cfqd, cfqq); | 3203 | cfq_del_timer(cfqd, cfqq); |
3209 | cfq_clear_cfqq_wait_request(cfqq); | 3204 | cfq_clear_cfqq_wait_request(cfqq); |
3210 | __blk_run_queue(cfqd->queue); | 3205 | __blk_run_queue(cfqd->queue); |
3211 | } else | 3206 | } else { |
3207 | blkiocg_update_idle_time_stats( | ||
3208 | &cfqq->cfqg->blkg); | ||
3212 | cfq_mark_cfqq_must_dispatch(cfqq); | 3209 | cfq_mark_cfqq_must_dispatch(cfqq); |
3210 | } | ||
3213 | } | 3211 | } |
3214 | } else if (cfq_should_preempt(cfqd, cfqq, rq)) { | 3212 | } else if (cfq_should_preempt(cfqd, cfqq, rq)) { |
3215 | /* | 3213 | /* |
@@ -3235,7 +3233,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq) | |||
3235 | list_add_tail(&rq->queuelist, &cfqq->fifo); | 3233 | list_add_tail(&rq->queuelist, &cfqq->fifo); |
3236 | cfq_add_rq_rb(rq); | 3234 | cfq_add_rq_rb(rq); |
3237 | 3235 | ||
3238 | blkiocg_update_request_add_stats(&cfqq->cfqg->blkg, | 3236 | blkiocg_update_io_add_stats(&cfqq->cfqg->blkg, |
3239 | &cfqd->serving_group->blkg, rq_data_dir(rq), | 3237 | &cfqd->serving_group->blkg, rq_data_dir(rq), |
3240 | rq_is_sync(rq)); | 3238 | rq_is_sync(rq)); |
3241 | cfq_rq_enqueued(cfqd, cfqq, rq); | 3239 | cfq_rq_enqueued(cfqd, cfqq, rq); |