Commit afc24d49c1e5dbeef745c1c1246f5ae6ebd97c71

Authored by Vivek Goyal
Committed by Jens Axboe
1 parent e5ff082e8a

blk-cgroup: config options re-arrangement

This patch fixes few usability and configurability issues.

o All the cgroup based controller options are configurable from
  "Genral Setup/Control Group Support/" menu. blkio is the only exception.
  Hence make this option visible in above menu and make it configurable from
  there to bring it inline with rest of the cgroup based controllers.

o Get rid of CONFIG_DEBUG_CFQ_IOSCHED.

  This option currently does two things.

  - Enable printing of cgroup paths in blktrace
  - Enables CONFIG_DEBUG_BLK_CGROUP, which in turn displays additional stat
    files in cgroup.

  If we are using group scheduling, blktrace data is of not really much use
  if cgroup information is not present. To get this data, currently one has to
  also enable CONFIG_DEBUG_CFQ_IOSCHED, which in turn brings the overhead of
  all the additional debug stat files which is not desired.

  Hence, this patch moves printing of cgroup paths under
  CONFIG_CFQ_GROUP_IOSCHED.

  This allows us to get rid of CONFIG_DEBUG_CFQ_IOSCHED completely. Now all
  the debug stat files are controlled only by CONFIG_DEBUG_BLK_CGROUP which
  can be enabled through config menu.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Divyesh Shah <dpshah@google.com>
Reviewed-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 7 changed files with 55 additions and 64 deletions Side-by-side Diff

Documentation/cgroups/blkio-controller.txt
... ... @@ -17,6 +17,9 @@
17 17 You can do a very simple testing of running two dd threads in two different
18 18 cgroups. Here is what you can do.
19 19  
  20 +- Enable Block IO controller
  21 + CONFIG_BLK_CGROUP=y
  22 +
20 23 - Enable group scheduling in CFQ
21 24 CONFIG_CFQ_GROUP_IOSCHED=y
22 25  
23 26  
24 27  
25 28  
... ... @@ -54,25 +57,17 @@
54 57  
55 58 Various user visible config options
56 59 ===================================
57   -CONFIG_CFQ_GROUP_IOSCHED
58   - - Enables group scheduling in CFQ. Currently only 1 level of group
59   - creation is allowed.
60   -
61   -CONFIG_DEBUG_CFQ_IOSCHED
62   - - Enables some debugging messages in blktrace. Also creates extra
63   - cgroup file blkio.dequeue.
64   -
65   -Config options selected automatically
66   -=====================================
67   -These config options are not user visible and are selected/deselected
68   -automatically based on IO scheduler configuration.
69   -
70 60 CONFIG_BLK_CGROUP
71   - - Block IO controller. Selected by CONFIG_CFQ_GROUP_IOSCHED.
  61 + - Block IO controller.
72 62  
73 63 CONFIG_DEBUG_BLK_CGROUP
74   - - Debug help. Selected by CONFIG_DEBUG_CFQ_IOSCHED.
  64 + - Debug help. Right now some additional stats file show up in cgroup
  65 + if this option is enabled.
75 66  
  67 +CONFIG_CFQ_GROUP_IOSCHED
  68 + - Enables group scheduling in CFQ. Currently only 1 level of group
  69 + creation is allowed.
  70 +
76 71 Details of cgroup files
77 72 =======================
78 73 - blkio.weight
79 74  
... ... @@ -174,13 +169,13 @@
174 169 write, sync or async.
175 170  
176 171 - blkio.avg_queue_size
177   - - Debugging aid only enabled if CONFIG_DEBUG_CFQ_IOSCHED=y.
  172 + - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y.
178 173 The average queue size for this cgroup over the entire time of this
179 174 cgroup's existence. Queue size samples are taken each time one of the
180 175 queues of this cgroup gets a timeslice.
181 176  
182 177 - blkio.group_wait_time
183   - - Debugging aid only enabled if CONFIG_DEBUG_CFQ_IOSCHED=y.
  178 + - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y.
184 179 This is the amount of time the cgroup had to wait since it became busy
185 180 (i.e., went from 0 to 1 request queued) to get a timeslice for one of
186 181 its queues. This is different from the io_wait_time which is the
... ... @@ -191,7 +186,7 @@
191 186 got a timeslice and will not include the current delta.
192 187  
193 188 - blkio.empty_time
194   - - Debugging aid only enabled if CONFIG_DEBUG_CFQ_IOSCHED=y.
  189 + - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y.
195 190 This is the amount of time a cgroup spends without any pending
196 191 requests when not being served, i.e., it does not include any time
197 192 spent idling for one of the queues of the cgroup. This is in
... ... @@ -200,7 +195,7 @@
200 195 time it had a pending request and will not include the current delta.
201 196  
202 197 - blkio.idle_time
203   - - Debugging aid only enabled if CONFIG_DEBUG_CFQ_IOSCHED=y.
  198 + - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y.
204 199 This is the amount of time spent by the IO scheduler idling for a
205 200 given cgroup in anticipation of a better request than the exising ones
206 201 from other queues/cgroups. This is in nanoseconds. If this is read
... ... @@ -209,7 +204,7 @@
209 204 the current delta.
210 205  
211 206 - blkio.dequeue
212   - - Debugging aid only enabled if CONFIG_DEBUG_CFQ_IOSCHED=y. This
  207 + - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y. This
213 208 gives the statistics about how many a times a group was dequeued
214 209 from service tree of the device. First two fields specify the major
215 210 and minor number of the device and third field specifies the number
... ... @@ -77,29 +77,6 @@
77 77 T10/SCSI Data Integrity Field or the T13/ATA External Path
78 78 Protection. If in doubt, say N.
79 79  
80   -config BLK_CGROUP
81   - tristate "Block cgroup support"
82   - depends on CGROUPS
83   - depends on CFQ_GROUP_IOSCHED
84   - default n
85   - ---help---
86   - Generic block IO controller cgroup interface. This is the common
87   - cgroup interface which should be used by various IO controlling
88   - policies.
89   -
90   - Currently, CFQ IO scheduler uses it to recognize task groups and
91   - control disk bandwidth allocation (proportional time slice allocation)
92   - to such task groups.
93   -
94   -config DEBUG_BLK_CGROUP
95   - bool
96   - depends on BLK_CGROUP
97   - default n
98   - ---help---
99   - Enable some debugging help. Currently it stores the cgroup path
100   - in the blk group which can be used by cfq for tracing various
101   - group related activity.
102   -
103 80 endif # BLOCK
104 81  
105 82 config BLOCK_COMPAT
block/Kconfig.iosched
... ... @@ -23,7 +23,8 @@
23 23  
24 24 config IOSCHED_CFQ
25 25 tristate "CFQ I/O scheduler"
26   - select BLK_CGROUP if CFQ_GROUP_IOSCHED
  26 + # If BLK_CGROUP is a module, CFQ has to be built as module.
  27 + depends on (BLK_CGROUP=m && m) || !BLK_CGROUP || BLK_CGROUP=y
27 28 default y
28 29 ---help---
29 30 The CFQ I/O scheduler tries to distribute bandwidth equally
30 31  
31 32  
... ... @@ -33,21 +34,14 @@
33 34  
34 35 This is the default I/O scheduler.
35 36  
  37 + Note: If BLK_CGROUP=m, then CFQ can be built only as module.
  38 +
36 39 config CFQ_GROUP_IOSCHED
37 40 bool "CFQ Group Scheduling support"
38   - depends on IOSCHED_CFQ && CGROUPS
  41 + depends on IOSCHED_CFQ && BLK_CGROUP
39 42 default n
40 43 ---help---
41 44 Enable group IO scheduling in CFQ.
42   -
43   -config 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 45  
52 46 choice
53 47 prompt "Default I/O scheduler"
... ... @@ -351,10 +351,8 @@
351 351 blkg->blkcg_id = css_id(&blkcg->css);
352 352 hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
353 353 spin_unlock_irqrestore(&blkcg->lock, flags);
354   -#ifdef CONFIG_DEBUG_BLK_CGROUP
355 354 /* Need to take css reference ? */
356 355 cgroup_path(blkcg->css.cgroup, blkg->path, sizeof(blkg->path));
357   -#endif
358 356 blkg->dev = dev;
359 357 }
360 358 EXPORT_SYMBOL_GPL(blkiocg_add_blkio_group);
... ... @@ -108,10 +108,8 @@
108 108 void *key;
109 109 struct hlist_node blkcg_node;
110 110 unsigned short blkcg_id;
111   -#ifdef CONFIG_DEBUG_BLK_CGROUP
112 111 /* Store cgroup path */
113 112 char path[128];
114   -#endif
115 113 /* The device MKDEV(major, minor), this group has been created for */
116 114 dev_t dev;
117 115  
... ... @@ -147,6 +145,11 @@
147 145 extern void blkio_policy_register(struct blkio_policy_type *);
148 146 extern void blkio_policy_unregister(struct blkio_policy_type *);
149 147  
  148 +static inline char *blkg_path(struct blkio_group *blkg)
  149 +{
  150 + return blkg->path;
  151 +}
  152 +
150 153 #else
151 154  
152 155 struct blkio_group {
... ... @@ -158,6 +161,8 @@
158 161 static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { }
159 162 static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
160 163  
  164 +static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
  165 +
161 166 #endif
162 167  
163 168 #define BLKIO_WEIGHT_MIN 100
... ... @@ -165,10 +170,6 @@
165 170 #define BLKIO_WEIGHT_DEFAULT 500
166 171  
167 172 #ifdef CONFIG_DEBUG_BLK_CGROUP
168   -static inline char *blkg_path(struct blkio_group *blkg)
169   -{
170   - return blkg->path;
171   -}
172 173 void blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg);
173 174 void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
174 175 unsigned long dequeue);
... ... @@ -197,7 +198,6 @@
197 198 BLKG_FLAG_FNS(empty)
198 199 #undef BLKG_FLAG_FNS
199 200 #else
200   -static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
201 201 static inline void blkiocg_update_avg_queue_size_stats(
202 202 struct blkio_group *blkg) {}
203 203 static inline void blkiocg_update_dequeue_stats(struct blkio_group *blkg,
... ... @@ -345,7 +345,7 @@
345 345 CFQ_CFQQ_FNS(wait_busy);
346 346 #undef CFQ_CFQQ_FNS
347 347  
348   -#ifdef CONFIG_DEBUG_CFQ_IOSCHED
  348 +#ifdef CONFIG_CFQ_GROUP_IOSCHED
349 349 #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \
350 350 blk_add_trace_msg((cfqd)->queue, "cfq%d%c %s " fmt, (cfqq)->pid, \
351 351 cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \
... ... @@ -612,6 +612,33 @@
612 612  
613 613 endif #CGROUP_SCHED
614 614  
  615 +config BLK_CGROUP
  616 + tristate "Block IO controller"
  617 + depends on CGROUPS && BLOCK
  618 + default n
  619 + ---help---
  620 + Generic block IO controller cgroup interface. This is the common
  621 + cgroup interface which should be used by various IO controlling
  622 + policies.
  623 +
  624 + Currently, CFQ IO scheduler uses it to recognize task groups and
  625 + control disk bandwidth allocation (proportional time slice allocation)
  626 + to such task groups.
  627 +
  628 + This option only enables generic Block IO controller infrastructure.
  629 + One needs to also enable actual IO controlling logic in CFQ for it
  630 + to take effect. (CONFIG_CFQ_GROUP_IOSCHED=y).
  631 +
  632 + See Documentation/cgroups/blkio-controller.txt for more information.
  633 +
  634 +config DEBUG_BLK_CGROUP
  635 + bool "Enable Block IO controller debugging"
  636 + depends on BLK_CGROUP
  637 + default n
  638 + ---help---
  639 + Enable some debugging help. Currently it exports additional stat
  640 + files in a cgroup which can be useful for debugging.
  641 +
615 642 endif # CGROUPS
616 643  
617 644 config MM_OWNER