aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2009-12-03 12:59:48 -0500
committerJens Axboe <jens.axboe@oracle.com>2009-12-03 13:28:52 -0500
commit2868ef7b39490e6b41c2c61cd9a5cd891e778b54 (patch)
treee50e169e984d8bd201de2f73f98e31a65c028feb
parentb1c3576961847da26c91b1e97f226bb66be5fa3f (diff)
blkio: Some debugging aids for CFQ
o Some debugging aids for CFQ. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--block/Kconfig9
-rw-r--r--block/Kconfig.iosched9
-rw-r--r--block/blk-cgroup.c4
-rw-r--r--block/blk-cgroup.h13
-rw-r--r--block/cfq-iosched.c19
5 files changed, 53 insertions, 1 deletions
diff --git a/block/Kconfig b/block/Kconfig
index 6ba1a8e3388b..e20fbde0875c 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -90,6 +90,15 @@ config BLK_CGROUP
90 control disk bandwidth allocation (proportional time slice allocation) 90 control disk bandwidth allocation (proportional time slice allocation)
91 to such task groups. 91 to such task groups.
92 92
93config DEBUG_BLK_CGROUP
94 bool
95 depends on BLK_CGROUP
96 default n
97 ---help---
98 Enable some debugging help. Currently it stores the cgroup path
99 in the blk group which can be used by cfq for tracing various
100 group related activity.
101
93endif # BLOCK 102endif # BLOCK
94 103
95config BLOCK_COMPAT 104config BLOCK_COMPAT
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
index fa95fa770570..b71abfb0d726 100644
--- a/block/Kconfig.iosched
+++ b/block/Kconfig.iosched
@@ -40,6 +40,15 @@ config CFQ_GROUP_IOSCHED
40 ---help--- 40 ---help---
41 Enable group IO scheduling in CFQ. 41 Enable group IO scheduling in CFQ.
42 42
43config DEBUG_CFQ_IOSCHED
44 bool "Debug CFQ Scheduling"
45 depends on CFQ_GROUP_IOSCHED
46 select DEBUG_BLK_CGROUP
47 default n
48 ---help---
49 Enable CFQ IO scheduling debugging in CFQ. Currently it makes
50 blktrace output more verbose.
51
43choice 52choice
44 prompt "Default I/O scheduler" 53 prompt "Default I/O scheduler"
45 default DEFAULT_CFQ 54 default DEFAULT_CFQ
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 0426ab692fd5..6bc99a3865b0 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -33,6 +33,10 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
33 blkg->blkcg_id = css_id(&blkcg->css); 33 blkg->blkcg_id = css_id(&blkcg->css);
34 hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list); 34 hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
35 spin_unlock_irqrestore(&blkcg->lock, flags); 35 spin_unlock_irqrestore(&blkcg->lock, flags);
36#ifdef CONFIG_DEBUG_BLK_CGROUP
37 /* Need to take css reference ? */
38 cgroup_path(blkcg->css.cgroup, blkg->path, sizeof(blkg->path));
39#endif
36} 40}
37 41
38static void __blkiocg_del_blkio_group(struct blkio_group *blkg) 42static void __blkiocg_del_blkio_group(struct blkio_group *blkg)
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index cd50a2f8733e..3573199b298b 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -27,12 +27,25 @@ struct blkio_group {
27 void *key; 27 void *key;
28 struct hlist_node blkcg_node; 28 struct hlist_node blkcg_node;
29 unsigned short blkcg_id; 29 unsigned short blkcg_id;
30#ifdef CONFIG_DEBUG_BLK_CGROUP
31 /* Store cgroup path */
32 char path[128];
33#endif
30}; 34};
31 35
32#define BLKIO_WEIGHT_MIN 100 36#define BLKIO_WEIGHT_MIN 100
33#define BLKIO_WEIGHT_MAX 1000 37#define BLKIO_WEIGHT_MAX 1000
34#define BLKIO_WEIGHT_DEFAULT 500 38#define BLKIO_WEIGHT_DEFAULT 500
35 39
40#ifdef CONFIG_DEBUG_BLK_CGROUP
41static inline char *blkg_path(struct blkio_group *blkg)
42{
43 return blkg->path;
44}
45#else
46static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
47#endif
48
36#ifdef CONFIG_BLK_CGROUP 49#ifdef CONFIG_BLK_CGROUP
37extern struct blkio_cgroup blkio_root_cgroup; 50extern struct blkio_cgroup blkio_root_cgroup;
38extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); 51extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8bc31a50a57f..662d4e55b3c2 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -341,8 +341,21 @@ CFQ_CFQQ_FNS(coop);
341CFQ_CFQQ_FNS(deep); 341CFQ_CFQQ_FNS(deep);
342#undef CFQ_CFQQ_FNS 342#undef CFQ_CFQQ_FNS
343 343
344#ifdef CONFIG_DEBUG_CFQ_IOSCHED
345#define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \
346 blk_add_trace_msg((cfqd)->queue, "cfq%d%c %s " fmt, (cfqq)->pid, \
347 cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \
348 blkg_path(&(cfqq)->cfqg->blkg), ##args);
349
350#define cfq_log_cfqg(cfqd, cfqg, fmt, args...) \
351 blk_add_trace_msg((cfqd)->queue, "%s " fmt, \
352 blkg_path(&(cfqg)->blkg), ##args); \
353
354#else
344#define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \ 355#define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \
345 blk_add_trace_msg((cfqd)->queue, "cfq%d " fmt, (cfqq)->pid, ##args) 356 blk_add_trace_msg((cfqd)->queue, "cfq%d " fmt, (cfqq)->pid, ##args)
357#define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0);
358#endif
346#define cfq_log(cfqd, fmt, args...) \ 359#define cfq_log(cfqd, fmt, args...) \
347 blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args) 360 blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args)
348 361
@@ -832,6 +845,7 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg)
832 if (cfqg->nr_cfqq) 845 if (cfqg->nr_cfqq)
833 return; 846 return;
834 847
848 cfq_log_cfqg(cfqd, cfqg, "del_from_rr group");
835 cfqg->on_st = false; 849 cfqg->on_st = false;
836 cfqd->nr_groups--; 850 cfqd->nr_groups--;
837 st->total_weight -= cfqg->weight; 851 st->total_weight -= cfqg->weight;
@@ -889,6 +903,9 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg,
889 cfqg->saved_serving_prio = cfqd->serving_prio; 903 cfqg->saved_serving_prio = cfqd->serving_prio;
890 } else 904 } else
891 cfqg->saved_workload_slice = 0; 905 cfqg->saved_workload_slice = 0;
906
907 cfq_log_cfqg(cfqd, cfqg, "served: vt=%llu min_vt=%llu", cfqg->vdisktime,
908 st->min_vdisktime);
892} 909}
893 910
894#ifdef CONFIG_CFQ_GROUP_IOSCHED 911#ifdef CONFIG_CFQ_GROUP_IOSCHED
@@ -3102,7 +3119,7 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
3102 unsigned long now; 3119 unsigned long now;
3103 3120
3104 now = jiffies; 3121 now = jiffies;
3105 cfq_log_cfqq(cfqd, cfqq, "complete"); 3122 cfq_log_cfqq(cfqd, cfqq, "complete rqnoidle %d", !!rq_noidle(rq));
3106 3123
3107 cfq_update_hw_tag(cfqd); 3124 cfq_update_hw_tag(cfqd);
3108 3125