diff options
author | Justin TerAvest <teravest@google.com> | 2011-03-12 10:54:00 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-03-12 10:54:00 -0500 |
commit | 167400d34070ebbc408dc0f447c4ddb4bf837360 (patch) | |
tree | 19100b0511a7e3e18f6f61d90a5fe5f1c40f59c4 /block/cfq-iosched.c | |
parent | 1f940bdfc0d03265d178d9dfd840d854819f797d (diff) |
blk-cgroup: Add unaccounted time to timeslice_used.
There are two kind of times that tasks are not charged for: the first
seek and the extra time slice used over the allocated timeslice. Both
of these exported as a new unaccounted_time stat.
I think it would be good to have this reported in 'time' as well, but
that is probably a separate discussion.
Signed-off-by: Justin TerAvest <teravest@google.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index c826ef81c679..89e0d1cc14ba 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -899,7 +899,8 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
899 | cfq_blkiocg_update_dequeue_stats(&cfqg->blkg, 1); | 899 | cfq_blkiocg_update_dequeue_stats(&cfqg->blkg, 1); |
900 | } | 900 | } |
901 | 901 | ||
902 | static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq) | 902 | static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq, |
903 | unsigned int *unaccounted_time) | ||
903 | { | 904 | { |
904 | unsigned int slice_used; | 905 | unsigned int slice_used; |
905 | 906 | ||
@@ -918,8 +919,13 @@ static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq) | |||
918 | 1); | 919 | 1); |
919 | } else { | 920 | } else { |
920 | slice_used = jiffies - cfqq->slice_start; | 921 | slice_used = jiffies - cfqq->slice_start; |
921 | if (slice_used > cfqq->allocated_slice) | 922 | if (slice_used > cfqq->allocated_slice) { |
923 | *unaccounted_time = slice_used - cfqq->allocated_slice; | ||
922 | slice_used = cfqq->allocated_slice; | 924 | slice_used = cfqq->allocated_slice; |
925 | } | ||
926 | if (time_after(cfqq->slice_start, cfqq->dispatch_start)) | ||
927 | *unaccounted_time += cfqq->slice_start - | ||
928 | cfqq->dispatch_start; | ||
923 | } | 929 | } |
924 | 930 | ||
925 | return slice_used; | 931 | return slice_used; |
@@ -929,12 +935,12 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg, | |||
929 | struct cfq_queue *cfqq) | 935 | struct cfq_queue *cfqq) |
930 | { | 936 | { |
931 | struct cfq_rb_root *st = &cfqd->grp_service_tree; | 937 | struct cfq_rb_root *st = &cfqd->grp_service_tree; |
932 | unsigned int used_sl, charge; | 938 | unsigned int used_sl, charge, unaccounted_sl = 0; |
933 | int nr_sync = cfqg->nr_cfqq - cfqg_busy_async_queues(cfqd, cfqg) | 939 | int nr_sync = cfqg->nr_cfqq - cfqg_busy_async_queues(cfqd, cfqg) |
934 | - cfqg->service_tree_idle.count; | 940 | - cfqg->service_tree_idle.count; |
935 | 941 | ||
936 | BUG_ON(nr_sync < 0); | 942 | BUG_ON(nr_sync < 0); |
937 | used_sl = charge = cfq_cfqq_slice_usage(cfqq); | 943 | used_sl = charge = cfq_cfqq_slice_usage(cfqq, &unaccounted_sl); |
938 | 944 | ||
939 | if (iops_mode(cfqd)) | 945 | if (iops_mode(cfqd)) |
940 | charge = cfqq->slice_dispatch; | 946 | charge = cfqq->slice_dispatch; |
@@ -960,7 +966,8 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg, | |||
960 | cfq_log_cfqq(cfqq->cfqd, cfqq, "sl_used=%u disp=%u charge=%u iops=%u" | 966 | cfq_log_cfqq(cfqq->cfqd, cfqq, "sl_used=%u disp=%u charge=%u iops=%u" |
961 | " sect=%u", used_sl, cfqq->slice_dispatch, charge, | 967 | " sect=%u", used_sl, cfqq->slice_dispatch, charge, |
962 | iops_mode(cfqd), cfqq->nr_sectors); | 968 | iops_mode(cfqd), cfqq->nr_sectors); |
963 | cfq_blkiocg_update_timeslice_used(&cfqg->blkg, used_sl); | 969 | cfq_blkiocg_update_timeslice_used(&cfqg->blkg, used_sl, |
970 | unaccounted_sl); | ||
964 | cfq_blkiocg_set_start_empty_time(&cfqg->blkg); | 971 | cfq_blkiocg_set_start_empty_time(&cfqg->blkg); |
965 | } | 972 | } |
966 | 973 | ||
@@ -3296,9 +3303,7 @@ static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
3296 | BUG_ON(!cfq_cfqq_on_rr(cfqq)); | 3303 | BUG_ON(!cfq_cfqq_on_rr(cfqq)); |
3297 | 3304 | ||
3298 | cfq_service_tree_add(cfqd, cfqq, 1); | 3305 | cfq_service_tree_add(cfqd, cfqq, 1); |
3299 | 3306 | __cfq_set_active_queue(cfqd, cfqq); | |
3300 | cfqq->slice_end = 0; | ||
3301 | cfq_mark_cfqq_slice_new(cfqq); | ||
3302 | } | 3307 | } |
3303 | 3308 | ||
3304 | /* | 3309 | /* |