* [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
* Re: [PATCH] dm-bufio: break out of both loops when freeing data
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
0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2014-10-01 17:35 UTC (permalink / raw)
To: Edward Thornber, dm-devel; +Cc: Mike Snitzer, Alasdair G. Kergon
On Wed, 1 Oct 2014, Mikulas Patocka wrote:
> 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>
I forgot to add:
Cc: stable@vger.kernel.org # 3.2+
> ---
> 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
* Re: dm-bufio: break out of both loops when freeing data
2014-10-01 17:35 ` Mikulas Patocka
@ 2014-10-01 18:42 ` Mike Snitzer
0 siblings, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2014-10-01 18:42 UTC (permalink / raw)
To: Mikulas Patocka; +Cc: dm-devel, Edward Thornber, Alasdair G. Kergon
On Wed, Oct 01 2014 at 1:35pm -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:
>
>
> On Wed, 1 Oct 2014, Mikulas Patocka wrote:
>
> > 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>
>
> I forgot to add:
>
> Cc: stable@vger.kernel.org # 3.2+
I tweaked the header, used a return rather than goto, and staged in
linux-next for 3.18. See:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=04c308f43a90a9b3b84c344b324d6af29288da05
^ 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.