]> git.ipfire.org Git - people/ms/linux.git/commit
dm bufio: fully initialize shrinker
authorGreg Thelen <gthelen@google.com>
Thu, 31 Jul 2014 16:07:19 +0000 (09:07 -0700)
committerJiri Slaby <jslaby@suse.cz>
Tue, 19 Aug 2014 12:23:37 +0000 (14:23 +0200)
commit9ee4fa038c195fc4ccd45aedaafbc8fd489ec33b
treeeda6dc9c9c8931c46179d78d677c10aae247145d
parent8504485d7e3adb86929a240e7e3fafc855c52bc2
dm bufio: fully initialize shrinker

commit d8c712ea471ce7a4fd1734ad2211adf8469ddddc upstream.

1d3d4437eae1 ("vmscan: per-node deferred work") added a flags field to
struct shrinker assuming that all shrinkers were zero filled.  The dm
bufio shrinker is not zero filled, which leaves arbitrary kmalloc() data
in flags.  So far the only defined flags bit is SHRINKER_NUMA_AWARE.
But there are proposed patches which add other bits to shrinker.flags
(e.g. memcg awareness).

Rather than simply initializing the shrinker, this patch uses kzalloc()
when allocating the dm_bufio_client to ensure that the embedded shrinker
and any other similar structures are zeroed.

This fixes theoretical over aggressive shrinking of dm bufio objects.
If the uninitialized dm_bufio_client.shrinker.flags contains
SHRINKER_NUMA_AWARE then shrink_slab() would call the dm shrinker for
each numa node rather than just once.  This has been broken since 3.12.

Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/md/dm-bufio.c