aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-08 13:53:57 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-20 07:45:37 -0400
commit5fe224d2d5fbf8f020b30d0ba69fed7856923752 (patch)
tree26941c40cd28c4f7070e8edab338d340afd2bc99 /block
parent1cd9e039fc258f91fe38b97b3c622b13a3b8a795 (diff)
blkcg: don't use percpu for merged stats
With recent plug merge updates, merged stats are no longer called for plug merges and now only updated while holding queue_lock. As stats_lock is scheduled to be removed, there's no reason to use percpu for merged stats. Don't use percpu for merged stats. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-cgroup.c26
-rw-r--r--block/blk-cgroup.h6
2 files changed, 9 insertions, 23 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 622fb4143226..6eedf3afa276 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -451,27 +451,13 @@ void blkiocg_update_io_merged_stats(struct blkio_group *blkg,
451 bool direction, bool sync) 451 bool direction, bool sync)
452{ 452{
453 struct blkg_policy_data *pd = blkg->pd[pol->plid]; 453 struct blkg_policy_data *pd = blkg->pd[pol->plid];
454 struct blkio_group_stats_cpu *stats_cpu; 454 struct blkio_group_stats *stats;
455 unsigned long flags; 455 unsigned long flags;
456 456
457 /* If per cpu stats are not allocated yet, don't do any accounting. */ 457 spin_lock_irqsave(&blkg->stats_lock, flags);
458 if (pd->stats_cpu == NULL) 458 stats = &pd->stats;
459 return; 459 blkio_add_stat(stats->stat_arr[BLKIO_STAT_MERGED], 1, direction, sync);
460 460 spin_unlock_irqrestore(&blkg->stats_lock, flags);
461 /*
462 * Disabling interrupts to provide mutual exclusion between two
463 * writes on same cpu. It probably is not needed for 64bit. Not
464 * optimizing that case yet.
465 */
466 local_irq_save(flags);
467
468 stats_cpu = this_cpu_ptr(pd->stats_cpu);
469
470 u64_stats_update_begin(&stats_cpu->syncp);
471 blkio_add_stat(stats_cpu->stat_arr_cpu[BLKIO_STAT_CPU_MERGED], 1,
472 direction, sync);
473 u64_stats_update_end(&stats_cpu->syncp);
474 local_irq_restore(flags);
475} 461}
476EXPORT_SYMBOL_GPL(blkiocg_update_io_merged_stats); 462EXPORT_SYMBOL_GPL(blkiocg_update_io_merged_stats);
477 463
@@ -1342,7 +1328,7 @@ static int blkiocg_file_read_map(struct cgroup *cgrp, struct cftype *cft,
1342 BLKIO_STAT_WAIT_TIME, 1, 0); 1328 BLKIO_STAT_WAIT_TIME, 1, 0);
1343 case BLKIO_PROP_io_merged: 1329 case BLKIO_PROP_io_merged:
1344 return blkio_read_blkg_stats(blkcg, cft, cb, 1330 return blkio_read_blkg_stats(blkcg, cft, cb,
1345 BLKIO_STAT_CPU_MERGED, 1, 1); 1331 BLKIO_STAT_MERGED, 1, 0);
1346 case BLKIO_PROP_io_queued: 1332 case BLKIO_PROP_io_queued:
1347 return blkio_read_blkg_stats(blkcg, cft, cb, 1333 return blkio_read_blkg_stats(blkcg, cft, cb,
1348 BLKIO_STAT_QUEUED, 1, 0); 1334 BLKIO_STAT_QUEUED, 1, 0);
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 1de32fe0e2af..6c8e3e345426 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -29,10 +29,12 @@ enum blkio_policy_id {
29#ifdef CONFIG_BLK_CGROUP 29#ifdef CONFIG_BLK_CGROUP
30 30
31enum stat_type { 31enum stat_type {
32 /* Number of IOs merged */
33 BLKIO_STAT_MERGED,
32 /* Total time spent (in ns) between request dispatch to the driver and 34 /* Total time spent (in ns) between request dispatch to the driver and
33 * request completion for IOs doen by this cgroup. This may not be 35 * request completion for IOs doen by this cgroup. This may not be
34 * accurate when NCQ is turned on. */ 36 * accurate when NCQ is turned on. */
35 BLKIO_STAT_SERVICE_TIME = 0, 37 BLKIO_STAT_SERVICE_TIME,
36 /* Total time spent waiting in scheduler queue in ns */ 38 /* Total time spent waiting in scheduler queue in ns */
37 BLKIO_STAT_WAIT_TIME, 39 BLKIO_STAT_WAIT_TIME,
38 /* Number of IOs queued up */ 40 /* Number of IOs queued up */
@@ -57,8 +59,6 @@ enum stat_type_cpu {
57 BLKIO_STAT_CPU_SERVICE_BYTES, 59 BLKIO_STAT_CPU_SERVICE_BYTES,
58 /* Total IOs serviced, post merge */ 60 /* Total IOs serviced, post merge */
59 BLKIO_STAT_CPU_SERVICED, 61 BLKIO_STAT_CPU_SERVICED,
60 /* Number of IOs merged */
61 BLKIO_STAT_CPU_MERGED,
62 BLKIO_STAT_CPU_NR 62 BLKIO_STAT_CPU_NR
63}; 63};
64 64