On Mon, Jan 30, 2017 at 10:49:36AM +0100, Michal Hocko wrote: > From: Michal Hocko > > There are many code paths opencoding kvmalloc. Let's use the helper > instead. The main difference to kvmalloc is that those users are usually > not considering all the aspects of the memory allocator. E.g. allocation > requests <= 32kB (with 4kB pages) are basically never failing and invoke > OOM killer to satisfy the allocation. This sounds too disruptive for > something that has a reasonable fallback - the vmalloc. On the other > hand those requests might fallback to vmalloc even when the memory > allocator would succeed after several more reclaim/compaction attempts > previously. There is no guarantee something like that happens though. > > This patch converts many of those places to kv[mz]alloc* helpers because > they are more conservative. > > Changes since v1 > - add kvmalloc_array - this might silently fix some overflow issues > because most users simply didn't check the overflow for the vmalloc > fallback. > > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Herbert Xu > Cc: Anton Vorontsov > Cc: Colin Cross > Cc: Kees Cook > Cc: Tony Luck > Cc: "Rafael J. Wysocki" > Cc: Ben Skeggs > Cc: Kent Overstreet > Cc: Santosh Raspatur > Cc: Hariprasad S > Cc: Yishai Hadas > Cc: Oleg Drokin > Cc: "Yan, Zheng" > Cc: Alexander Viro > Cc: Alexei Starovoitov > Cc: Eric Dumazet > Cc: netdev@vger.kernel.org > Acked-by: Andreas Dilger # Lustre > Reviewed-by: Boris Ostrovsky # Xen bits > Acked-by: Christian Borntraeger # KVM/s390 > Acked-by: Dan Williams # nvdim > Acked-by: David Sterba # btrfs > Acked-by: Ilya Dryomov # Ceph > Acked-by: Tariq Toukan # mlx4 > Signed-off-by: Michal Hocko Acked-by: Leon Romanovsky # mlx5