aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-01 17:38:44 -0400
committerTejun Heo <tj@kernel.org>2012-04-01 17:38:44 -0400
commit41b38b6d540f951c49315d8573e6f6195a6e736d (patch)
treee667cec0bba6e7678810ff0087c96547a21a45c7 /block/blk-cgroup.c
parent629ed0b10209ffc4e1d439e5508d52d5e3a090b8 (diff)
blkcg: cfq doesn't need per-cpu dispatch stats
blkio_group_stats_cpu is used to count dispatch stats using per-cpu counters. This is used by both blk-throtl and cfq-iosched but the sharing is rather silly. * cfq-iosched doesn't need per-cpu dispatch stats. cfq always updates those stats while holding queue_lock. * blk-throtl needs per-cpu dispatch stats but only service_bytes and serviced. It doesn't make use of sectors. This patch makes cfq add and use global stats for service_bytes, serviced and sectors, removes per-cpu sectors counter and moves per-cpu stat printing code to blk-throttle.c. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c63
1 files changed, 2 insertions, 61 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 821a0a393e85..19ee29f1b7c5 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -390,7 +390,6 @@ static void blkio_reset_stats_cpu(struct blkio_group *blkg, int plid)
390 390
391 blkg_rwstat_reset(&sc->service_bytes); 391 blkg_rwstat_reset(&sc->service_bytes);
392 blkg_rwstat_reset(&sc->serviced); 392 blkg_rwstat_reset(&sc->serviced);
393 blkg_stat_reset(&sc->sectors);
394 } 393 }
395} 394}
396 395
@@ -417,6 +416,8 @@ blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val)
417 struct blkio_group_stats *stats = &pd->stats; 416 struct blkio_group_stats *stats = &pd->stats;
418 417
419 /* queued stats shouldn't be cleared */ 418 /* queued stats shouldn't be cleared */
419 blkg_rwstat_reset(&stats->service_bytes);
420 blkg_rwstat_reset(&stats->serviced);
420 blkg_rwstat_reset(&stats->merged); 421 blkg_rwstat_reset(&stats->merged);
421 blkg_rwstat_reset(&stats->service_time); 422 blkg_rwstat_reset(&stats->service_time);
422 blkg_rwstat_reset(&stats->wait_time); 423 blkg_rwstat_reset(&stats->wait_time);
@@ -577,66 +578,6 @@ int blkcg_print_rwstat(struct cgroup *cgrp, struct cftype *cft,
577} 578}
578EXPORT_SYMBOL_GPL(blkcg_print_rwstat); 579EXPORT_SYMBOL_GPL(blkcg_print_rwstat);
579 580
580static u64 blkg_prfill_cpu_stat(struct seq_file *sf,
581 struct blkg_policy_data *pd, int off)
582{
583 u64 v = 0;
584 int cpu;
585
586 for_each_possible_cpu(cpu) {
587 struct blkio_group_stats_cpu *sc =
588 per_cpu_ptr(pd->stats_cpu, cpu);
589
590 v += blkg_stat_read((void *)sc + off);
591 }
592
593 return __blkg_prfill_u64(sf, pd, v);
594}
595
596static u64 blkg_prfill_cpu_rwstat(struct seq_file *sf,
597 struct blkg_policy_data *pd, int off)
598{
599 struct blkg_rwstat rwstat = { }, tmp;
600 int i, cpu;
601
602 for_each_possible_cpu(cpu) {
603 struct blkio_group_stats_cpu *sc =
604 per_cpu_ptr(pd->stats_cpu, cpu);
605
606 tmp = blkg_rwstat_read((void *)sc + off);
607 for (i = 0; i < BLKG_RWSTAT_NR; i++)
608 rwstat.cnt[i] += tmp.cnt[i];
609 }
610
611 return __blkg_prfill_rwstat(sf, pd, &rwstat);
612}
613
614/* print per-cpu blkg_stat specified by BLKCG_STAT_PRIV() */
615int blkcg_print_cpu_stat(struct cgroup *cgrp, struct cftype *cft,
616 struct seq_file *sf)
617{
618 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
619
620 blkcg_print_blkgs(sf, blkcg, blkg_prfill_cpu_stat,
621 BLKCG_STAT_POL(cft->private),
622 BLKCG_STAT_OFF(cft->private), false);
623 return 0;
624}
625EXPORT_SYMBOL_GPL(blkcg_print_cpu_stat);
626
627/* print per-cpu blkg_rwstat specified by BLKCG_STAT_PRIV() */
628int blkcg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft,
629 struct seq_file *sf)
630{
631 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp);
632
633 blkcg_print_blkgs(sf, blkcg, blkg_prfill_cpu_rwstat,
634 BLKCG_STAT_POL(cft->private),
635 BLKCG_STAT_OFF(cft->private), true);
636 return 0;
637}
638EXPORT_SYMBOL_GPL(blkcg_print_cpu_rwstat);
639
640/** 581/**
641 * blkg_conf_prep - parse and prepare for per-blkg config update 582 * blkg_conf_prep - parse and prepare for per-blkg config update
642 * @blkcg: target block cgroup 583 * @blkcg: target block cgroup