aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-10-01 13:29:48 -0400
committerMike Snitzer <snitzer@redhat.com>2014-10-01 14:34:48 -0400
commit04c308f43a90a9b3b84c344b324d6af29288da05 (patch)
tree5dde692ee0a96f7626fa16920a691f048e06c0d9
parent4a28bf05e8e00383910bc5c38d42f2936ec900c9 (diff)
downloadlinux-dm-04c308f43a90a9b3b84c344b324d6af29288da05.tar.gz
dm bufio: when done scanning return from __scan immediately
Notice: this object is not reachable from any branch.
When __scan frees the required number of buffer entries that the shrinker requested (nr_to_scan becomes zero) it must return. Before this fix the __scan code exited only the inner loop and continued in the outer loop. Also, move dm_bufio_cond_resched to __scan's inner loop, so that iterating the bufio client's lru lists doesn't result in scheduling latency. Reported-by: Joe Thornber <thornber@redhat.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: stable@vger.kernel.org # 3.2+
Notice: this object is not reachable from any branch.
-rw-r--r--drivers/md/dm-bufio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index eab64bcaab666..9ea5b6041eb20 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1473,9 +1473,9 @@ static long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan,
list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) {
freed += __cleanup_old_buffer(b, gfp_mask, 0);
if (!--nr_to_scan)
- break;
+ return freed;
+ dm_bufio_cond_resched();
}
- dm_bufio_cond_resched();
}
return freed;
}