summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-gc.c
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2017-10-13 14:46:45 +0200
committerJens Axboe <axboe@kernel.dk>2017-10-13 16:34:57 +0200
commit8da10cce7c7f7f9f5edc77271cf6e0c45b762004 (patch)
treedf5e06e0c677893b7376da4d6510e5538fe199c5 /drivers/lightnvm/pblk-gc.c
parentlightnvm: pblk: cleanup unused and static functions (diff)
downloadlinux-8da10cce7c7f7f9f5edc77271cf6e0c45b762004.tar.xz
linux-8da10cce7c7f7f9f5edc77271cf6e0c45b762004.zip
lightnvm: pblk: avoid being reported as hung on rated GC
The amount of GC I/O on the write buffer is managed by the rate-limiter, which is calculated as a function of the number of available free blocks. When reaching the stable point, we risk having scheduled more I/Os for GC than are allowed on the write buffer. This would result on the GC semaphore balancing the outstanding read GC I/Os to be reported as "hung", though the behavior is normal. Solve this by allowing to schedule when we detect that the read GC path is not moving forward. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-gc.c')
-rw-r--r--drivers/lightnvm/pblk-gc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
index b8323e34d1bc..00d5698d64a9 100644
--- a/drivers/lightnvm/pblk-gc.c
+++ b/drivers/lightnvm/pblk-gc.c
@@ -218,7 +218,13 @@ next_rq:
gc_rq_ws->line = line;
gc_rq_ws->priv = gc_rq;
- down(&gc->gc_sem);
+ /* The write GC path can be much slower than the read GC one due to
+ * the budget imposed by the rate-limiter. Balance in case that we get
+ * back pressure from the write GC path.
+ */
+ while (down_timeout(&gc->gc_sem, msecs_to_jiffies(30000)))
+ io_schedule();
+
kref_get(&line->ref);
INIT_WORK(&gc_rq_ws->ws, pblk_gc_line_ws);