Re: [PATCH 4/4] mm: allow !GFP_KERNEL allocations for kvmalloc
From: Michal Hocko
Date: Tue Oct 26 2021 - 08:23:38 EST
On Tue 26-10-21 21:48:05, Neil Brown wrote:
> On Tue, 26 Oct 2021, Michal Hocko wrote:
[...]
> > > GFP_NOWAIT is not a modifier. It is a base value that can be modified.
> > > I think you mean that
> > > __GFP_NORETRY is not supported and __GFP_DIRECT_RECLAIM is required
> >
> > I thought naming the higher level gfp mask would be more helpful here.
> > Most people do not tend to think in terms of __GFP_DIRECT_RECLAIM but
> > rather GFP_NOWAIT or GFP_ATOMIC.
>
> Maybe it would. But the text says "Reclaim modifiers" and then lists
> one modifier and one mask. That is confusing.
> If you want to mention both, keep them separate.
>
> GFP_NOWAIT and GFP_ATOMIC are not supported, neither is the
> __GFP_NORETRY modifier.
>
> or something like that.
Fair enough. I went with this
commit fb93996c217cea864a3b3ffa8a8cd482bf0a1f62
Author: Michal Hocko <mhocko@xxxxxxxx>
Date: Tue Oct 26 14:23:00 2021 +0200
fold me "mm: allow !GFP_KERNEL allocations for kvmalloc"
diff --git a/mm/util.c b/mm/util.c
index fdec6b4b1267..1fb6dd907bb0 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -549,7 +549,7 @@ EXPORT_SYMBOL(vm_mmap);
* Uses kmalloc to get the memory but if the allocation fails then falls back
* to the vmalloc allocator. Use kvfree for freeing the memory.
*
- * Reclaim modifiers - __GFP_NORETRY and GFP_NOWAIT are not supported.
+ * GFP_NOWAIT and GFP_ATOMIC are not supported, neither is the __GFP_NORETRY modifier.
* __GFP_RETRY_MAYFAIL is supported, and it should be used only if kmalloc is
* preferable to the vmalloc fallback, due to visible performance drawbacks.
*
--
Michal Hocko
SUSE Labs