mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-09-13 11:07:46 +10:00
kfence: skip __GFP_THISNODE allocations on NUMA systems
commite64f81946a
upstream. 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/20250124120145.410066-1-elver@google.com Fixes:236e9f1538
("kfence: skip all GFP_ZONEMASK allocations") Signed-off-by: Marco Elver <elver@google.com> Reported-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Christoph Lameter <cl@linux.com> Cc: Alexander Potapenko <glider@google.com> Cc: Chistoph Lameter <cl@linux.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
aa2ed4ee8d
commit
621b80eb88
@ -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>
|
||||
@ -997,6 +998,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;
|
||||
|
Loading…
Reference in New Issue
Block a user