diff options
| author | Marco Elver <[email protected]> | 2025-01-24 12:01:38 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-02-01 11:53:26 +0000 |
| commit | e64f81946adf68cd75e2207dd9a51668348a4af8 (patch) | |
| tree | 7b0a03b5ca1d4e6c50a68db3deaa382d5d1bb431 | |
| parent | nilfs2: fix possible int overflows in nilfs_fiemap() (diff) | |
| download | kernel-e64f81946adf68cd75e2207dd9a51668348a4af8.tar.gz kernel-e64f81946adf68cd75e2207dd9a51668348a4af8.zip | |
kfence: skip __GFP_THISNODE allocations on NUMA systems
On NUMA systems, __GFP_THISNODE indicates that an allocation _must_ be on
a particular node, and failure to allocate on the desired node will result
in a failed allocation.
Skip __GFP_THISNODE allocations if we are running on a NUMA system, since
KFENCE can't guarantee which node its pool pages are allocated on.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 236e9f153852 ("kfence: skip all GFP_ZONEMASK allocations")
Signed-off-by: Marco Elver <[email protected]>
Reported-by: Vlastimil Babka <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Chistoph Lameter <[email protected]>
Cc: Dmitriy Vyukov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
| -rw-r--r-- | mm/kfence/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 67fc321db79b..102048821c22 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -21,6 +21,7 @@ #include <linux/log2.h> #include <linux/memblock.h> #include <linux/moduleparam.h> +#include <linux/nodemask.h> #include <linux/notifier.h> #include <linux/panic_notifier.h> #include <linux/random.h> @@ -1084,6 +1085,7 @@ void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags) * properties (e.g. reside in DMAable memory). */ if ((flags & GFP_ZONEMASK) || + ((flags & __GFP_THISNODE) && num_online_nodes() > 1) || (s->flags & (SLAB_CACHE_DMA | SLAB_CACHE_DMA32))) { atomic_long_inc(&counters[KFENCE_COUNTER_SKIP_INCOMPAT]); return NULL; |
