diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2011-05-23 04:02:19 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-05-23 04:02:19 -0400 |
commit | 317389a7739675aa990b7e0d750a7c435f1d25d7 (patch) | |
tree | c24b7bb45d03233d76405dab4f9406c05c44eafa /block | |
parent | 2abae55f5a41d29f21b5b259c33d218c950d5c90 (diff) |
cfq-iosched: Make IO merge related stats per cpu
Make BLKIO_STAT_MERGED per cpu hence gettring rid of need of taking
blkg->stats_lock.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 22 | ||||
-rw-r--r-- | block/blk-cgroup.h | 4 |
2 files changed, 19 insertions, 7 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index e41cc6f2ccc1..07371cfdfae6 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -441,15 +441,27 @@ void blkiocg_update_completion_stats(struct blkio_group *blkg, | |||
441 | } | 441 | } |
442 | EXPORT_SYMBOL_GPL(blkiocg_update_completion_stats); | 442 | EXPORT_SYMBOL_GPL(blkiocg_update_completion_stats); |
443 | 443 | ||
444 | /* Merged stats are per cpu. */ | ||
444 | void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, | 445 | void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, |
445 | bool sync) | 446 | bool sync) |
446 | { | 447 | { |
448 | struct blkio_group_stats_cpu *stats_cpu; | ||
447 | unsigned long flags; | 449 | unsigned long flags; |
448 | 450 | ||
449 | spin_lock_irqsave(&blkg->stats_lock, flags); | 451 | /* |
450 | blkio_add_stat(blkg->stats.stat_arr[BLKIO_STAT_MERGED], 1, direction, | 452 | * Disabling interrupts to provide mutual exclusion between two |
451 | sync); | 453 | * writes on same cpu. It probably is not needed for 64bit. Not |
452 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 454 | * optimizing that case yet. |
455 | */ | ||
456 | local_irq_save(flags); | ||
457 | |||
458 | stats_cpu = this_cpu_ptr(blkg->stats_cpu); | ||
459 | |||
460 | u64_stats_update_begin(&stats_cpu->syncp); | ||
461 | blkio_add_stat(stats_cpu->stat_arr_cpu[BLKIO_STAT_CPU_MERGED], 1, | ||
462 | direction, sync); | ||
463 | u64_stats_update_end(&stats_cpu->syncp); | ||
464 | local_irq_restore(flags); | ||
453 | } | 465 | } |
454 | EXPORT_SYMBOL_GPL(blkiocg_update_io_merged_stats); | 466 | EXPORT_SYMBOL_GPL(blkiocg_update_io_merged_stats); |
455 | 467 | ||
@@ -1244,7 +1256,7 @@ static int blkiocg_file_read_map(struct cgroup *cgrp, struct cftype *cft, | |||
1244 | BLKIO_STAT_WAIT_TIME, 1, 0); | 1256 | BLKIO_STAT_WAIT_TIME, 1, 0); |
1245 | case BLKIO_PROP_io_merged: | 1257 | case BLKIO_PROP_io_merged: |
1246 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1258 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1247 | BLKIO_STAT_MERGED, 1, 0); | 1259 | BLKIO_STAT_CPU_MERGED, 1, 1); |
1248 | case BLKIO_PROP_io_queued: | 1260 | case BLKIO_PROP_io_queued: |
1249 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1261 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1250 | BLKIO_STAT_QUEUED, 1, 0); | 1262 | BLKIO_STAT_QUEUED, 1, 0); |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 262226798093..a71d2904ffb9 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -39,8 +39,6 @@ enum stat_type { | |||
39 | BLKIO_STAT_SERVICE_TIME = 0, | 39 | BLKIO_STAT_SERVICE_TIME = 0, |
40 | /* Total time spent waiting in scheduler queue in ns */ | 40 | /* Total time spent waiting in scheduler queue in ns */ |
41 | BLKIO_STAT_WAIT_TIME, | 41 | BLKIO_STAT_WAIT_TIME, |
42 | /* Number of IOs merged */ | ||
43 | BLKIO_STAT_MERGED, | ||
44 | /* Number of IOs queued up */ | 42 | /* Number of IOs queued up */ |
45 | BLKIO_STAT_QUEUED, | 43 | BLKIO_STAT_QUEUED, |
46 | /* All the single valued stats go below this */ | 44 | /* All the single valued stats go below this */ |
@@ -63,6 +61,8 @@ enum stat_type_cpu { | |||
63 | BLKIO_STAT_CPU_SERVICE_BYTES, | 61 | BLKIO_STAT_CPU_SERVICE_BYTES, |
64 | /* Total IOs serviced, post merge */ | 62 | /* Total IOs serviced, post merge */ |
65 | BLKIO_STAT_CPU_SERVICED, | 63 | BLKIO_STAT_CPU_SERVICED, |
64 | /* Number of IOs merged */ | ||
65 | BLKIO_STAT_CPU_MERGED, | ||
66 | BLKIO_STAT_CPU_NR | 66 | BLKIO_STAT_CPU_NR |
67 | }; | 67 | }; |
68 | 68 | ||