diff options
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r-- | block/blk-throttle.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 8331aba9426f..06534049afba 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -256,6 +256,12 @@ static struct throtl_data *sq_to_td(struct throtl_service_queue *sq) | |||
256 | } \ | 256 | } \ |
257 | } while (0) | 257 | } while (0) |
258 | 258 | ||
259 | static void tg_stats_init(struct tg_stats_cpu *tg_stats) | ||
260 | { | ||
261 | blkg_rwstat_init(&tg_stats->service_bytes); | ||
262 | blkg_rwstat_init(&tg_stats->serviced); | ||
263 | } | ||
264 | |||
259 | /* | 265 | /* |
260 | * Worker for allocating per cpu stat for tgs. This is scheduled on the | 266 | * Worker for allocating per cpu stat for tgs. This is scheduled on the |
261 | * system_wq once there are some groups on the alloc_list waiting for | 267 | * system_wq once there are some groups on the alloc_list waiting for |
@@ -269,12 +275,16 @@ static void tg_stats_alloc_fn(struct work_struct *work) | |||
269 | 275 | ||
270 | alloc_stats: | 276 | alloc_stats: |
271 | if (!stats_cpu) { | 277 | if (!stats_cpu) { |
278 | int cpu; | ||
279 | |||
272 | stats_cpu = alloc_percpu(struct tg_stats_cpu); | 280 | stats_cpu = alloc_percpu(struct tg_stats_cpu); |
273 | if (!stats_cpu) { | 281 | if (!stats_cpu) { |
274 | /* allocation failed, try again after some time */ | 282 | /* allocation failed, try again after some time */ |
275 | schedule_delayed_work(dwork, msecs_to_jiffies(10)); | 283 | schedule_delayed_work(dwork, msecs_to_jiffies(10)); |
276 | return; | 284 | return; |
277 | } | 285 | } |
286 | for_each_possible_cpu(cpu) | ||
287 | tg_stats_init(per_cpu_ptr(stats_cpu, cpu)); | ||
278 | } | 288 | } |
279 | 289 | ||
280 | spin_lock_irq(&tg_stats_alloc_lock); | 290 | spin_lock_irq(&tg_stats_alloc_lock); |