diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-10-01 13:29:48 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-10-05 20:03:37 -0400 |
commit | 0e825862f3c04cee40e25f55680333728a4ffa9b (patch) | |
tree | a036fac4e4bee64b32f71924b31acaf000184787 | |
parent | eb76faf53b1ff7a77ce3f78cc98ad392ac70c2a0 (diff) |
dm bufio: when done scanning return from __scan immediately
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 -- which could result in reduced performance due to extra
buffers being freed (e.g. unnecessarily evicted thinp metadata needing
to be synchronously re-read into bufio's cache).
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+
-rw-r--r-- | drivers/md/dm-bufio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index eab64bcaab66..9ea5b6041eb2 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, | |||
1473 | list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) { | 1473 | list_for_each_entry_safe_reverse(b, tmp, &c->lru[l], lru_list) { |
1474 | freed += __cleanup_old_buffer(b, gfp_mask, 0); | 1474 | freed += __cleanup_old_buffer(b, gfp_mask, 0); |
1475 | if (!--nr_to_scan) | 1475 | if (!--nr_to_scan) |
1476 | break; | 1476 | return freed; |
1477 | dm_bufio_cond_resched(); | ||
1477 | } | 1478 | } |
1478 | dm_bufio_cond_resched(); | ||
1479 | } | 1479 | } |
1480 | return freed; | 1480 | return freed; |
1481 | } | 1481 | } |