Re: [PATCH 3/6] lib/bucket_locks: use kvmalloc_array()
From: Michal Hocko
Date: Wed May 30 2018 - 03:42:26 EST
On Tue 29-05-18 15:46:25, Linus Torvalds wrote:
[...]
> The whole and ONLY point of "kvmalloc()" and friends is to make it easy to
> write code and _not_ have those idiotic "let's do kmalloc or kvmalloc
> depending on the phase of the moon" garbage. So the warning has literally
> destroyed the only value that function has!
Well, I do agree but I've also seen terrible things while doing the
conversion when introducing kvmalloc.
So I admit that the defensive mode here is mostly inspired by existing
users of vmalloc(GFP_NOFS). They are simply wrong and not really
eager to be fixed from my experience. Now with kvmalloc fixing them
up silently it would get even less likely to get fixed because there
won't be any deadlock possible (compared to open coded kvmalloc like
ext4_kvmalloc for example).
My experience also tells me that most of those vmalloc NOFS users
simply do not need NOFS at all because there is no risk of the reclaim
recursion deadlocks. They are just used because of cargo cult which is
sad and it causes some subtle problems for the direct reclaim. I would
really like to eliminate those (e.g. see [1]). It is sad reality that
people tend to be more sensitive to WARN splats than "look this is wrong
albeit not critical in most cases).
[1] http://lkml.kernel.org/r/20180424162712.GL17484@xxxxxxxxxxxxxx
That being sad, if you believe that silently fixing up a code like that
is a good idea we can do the following of course: