All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-bufio: break out of both loops when freeing data
@ 2014-10-01 17:29 Mikulas Patocka
  2014-10-01 17:35 ` Mikulas Patocka
  0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2014-10-01 17:29 UTC (permalink / raw)
  To: Edward Thornber, dm-devel; +Cc: Mike Snitzer, Alasdair G. Kergon

When we free the required number of entries (nr_to_scan becomes zero), we
must break out of both loops. The code exited only the inner loop and
continued in the outer loop.

Also, move dm_bufio_cond_resched to the inner loop, so that scanning the
list doesn't result in scheduling latency.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/md/dm-bufio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-3.17-rc7/drivers/md/dm-bufio.c
===================================================================
--- linux-3.17-rc7.orig/drivers/md/dm-bufio.c	2014-10-01 19:20:36.000000000 +0200
+++ linux-3.17-rc7/drivers/md/dm-bufio.c	2014-10-01 19:22:50.000000000 +0200
@@ -1473,10 +1473,12 @@ static long __scan(struct dm_bufio_clien
 		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;
+				goto brk;
+			dm_bufio_cond_resched();
 		}
-		dm_bufio_cond_resched();
 	}
+
+brk:
 	return freed;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-01 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 17:29 [PATCH] dm-bufio: break out of both loops when freeing data Mikulas Patocka
2014-10-01 17:35 ` Mikulas Patocka
2014-10-01 18:42   ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.