Commit d12067f4 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer

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: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 9ea61cac
...@@ -1588,18 +1588,9 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) ...@@ -1588,18 +1588,9 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
static unsigned long static unsigned long
dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc) dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
{ {
struct dm_bufio_client *c; struct dm_bufio_client *c = container_of(shrink, struct dm_bufio_client, shrinker);
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;
count = c->n_buffers[LIST_CLEAN] + c->n_buffers[LIST_DIRTY]; return ACCESS_ONCE(c->n_buffers[LIST_CLEAN]) + ACCESS_ONCE(c->n_buffers[LIST_DIRTY]);
dm_bufio_unlock(c);
return count;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment