* [PATCH 4.4, 4.9] dm bufio: don't take the lock in dm_bufio_shrink_count
@ 2018-07-04 14:41 Mikulas Patocka
2018-07-10 14:18 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2018-07-04 14:41 UTC (permalink / raw)
To: Greg Kroah-Hartman, stable
Cc: jing xia, David Rientjes, Guenter Roeck, Douglas Anderson,
Mike Snitzer
This is backport of the upstream patch
d12067f428c037b4575aaeb2be00847fc214c24a. It should be backported to
stable kernels because this performance problem was seen on the android
4.4 kernel.
commit d12067f428c037b4575aaeb2be00847fc214c24a
Author: Mikulas Patocka <mpatocka@redhat.com>
Date: Wed Nov 23 16:52:01 2016 -0500
dm bufio: don't take the lock in dm_bufio_shrink_count
dm_bufio_shrink_count() is called from do_shrink_slab to find out how many
freeable objects are there. The reported value doesn't have to be precise,
so we don't need to take the dm-bufio lock.
Suggested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/dm-bufio.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
Index: linux-stable/drivers/md/dm-bufio.c
===================================================================
--- linux-stable.orig/drivers/md/dm-bufio.c 2018-07-04 15:25:41.000000000 +0200
+++ linux-stable/drivers/md/dm-bufio.c 2018-07-04 15:33:59.000000000 +0200
@@ -1574,19 +1574,11 @@ dm_bufio_shrink_scan(struct shrinker *sh
static unsigned long
dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
{
- struct dm_bufio_client *c;
- unsigned long count;
- unsigned long retain_target;
+ struct dm_bufio_client *c = container_of(shrink, struct dm_bufio_client, shrinker);
+ unsigned long count = READ_ONCE(c->n_buffers[LIST_CLEAN]) +
+ READ_ONCE(c->n_buffers[LIST_DIRTY]);
+ unsigned long retain_target = get_retain_buffers(c);
- c = container_of(shrink, struct dm_bufio_client, shrinker);
- if (sc->gfp_mask & __GFP_FS)
- dm_bufio_lock(c);
- else if (!dm_bufio_trylock(c))
- return 0;
-
- count = c->n_buffers[LIST_CLEAN] + c->n_buffers[LIST_DIRTY];
- retain_target = get_retain_buffers(c);
- dm_bufio_unlock(c);
return (count < retain_target) ? 0 : (count - retain_target);
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 4.4, 4.9] dm bufio: don't take the lock in dm_bufio_shrink_count
2018-07-04 14:41 [PATCH 4.4, 4.9] dm bufio: don't take the lock in dm_bufio_shrink_count Mikulas Patocka
@ 2018-07-10 14:18 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2018-07-10 14:18 UTC (permalink / raw)
To: Mikulas Patocka
Cc: stable, jing xia, David Rientjes, Guenter Roeck, Douglas Anderson,
Mike Snitzer
On Wed, Jul 04, 2018 at 10:41:03AM -0400, Mikulas Patocka wrote:
> This is backport of the upstream patch
> d12067f428c037b4575aaeb2be00847fc214c24a. It should be backported to
> stable kernels because this performance problem was seen on the android
> 4.4 kernel.
Now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-10 14:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04 14:41 [PATCH 4.4, 4.9] dm bufio: don't take the lock in dm_bufio_shrink_count Mikulas Patocka
2018-07-10 14:18 ` Greg Kroah-Hartman
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.