summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2016-11-23 16:52:01 -0500
committerMike Snitzer <snitzer@redhat.com>2016-12-08 14:13:04 -0500
commitd12067f428c037b4575aaeb2be00847fc214c24a (patch)
tree7998dcb07191152c9e5ce83d0e44eaece082f1e6 /drivers/md
parent9ea61cac0b1ad0c09022f39fd97e9b99a2cfc2dc (diff)
downloadblackbird-op-linux-d12067f428c037b4575aaeb2be00847fc214c24a.tar.gz
blackbird-op-linux-d12067f428c037b4575aaeb2be00847fc214c24a.zip
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>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-bufio.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index b5d3428d109e..9ef88f0e2382 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1588,18 +1588,9 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
static unsigned long
dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
{
- struct dm_bufio_client *c;
- unsigned long count;
-
- 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;
+ struct dm_bufio_client *c = container_of(shrink, struct dm_bufio_client, shrinker);
- count = c->n_buffers[LIST_CLEAN] + c->n_buffers[LIST_DIRTY];
- dm_bufio_unlock(c);
- return count;
+ return ACCESS_ONCE(c->n_buffers[LIST_CLEAN]) + ACCESS_ONCE(c->n_buffers[LIST_DIRTY]);
}
/*
OpenPOWER on IntegriCloud