summaryrefslogtreecommitdiff
path: root/lib/debugobjects.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-03-09 03:46:38 +0300
committerAlexei Starovoitov <ast@kernel.org>2026-03-09 03:46:38 +0300
commit099bded7525d9803f62bc5a1ed60e2c9ec4851e0 (patch)
tree566d2cb10d3799b51a6cc7d20e49802b4f4a152b /lib/debugobjects.c
parent6dd780f973816133f189efec04118c1e6b1b443d (diff)
parent1f318b96cc84d7c2ab792fcc0bfd42a7ca890681 (diff)
downloadlinux-099bded7525d9803f62bc5a1ed60e2c9ec4851e0.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.0-rc3
Cross-merge BPF and other fixes after downstream PR. No conflicts. Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'lib/debugobjects.c')
-rw-r--r--lib/debugobjects.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 89a1d6745dc2..12f50de85b62 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -398,9 +398,26 @@ static void fill_pool(void)
atomic_inc(&cpus_allocating);
while (pool_should_refill(&pool_global)) {
+ gfp_t gfp = __GFP_HIGH | __GFP_NOWARN;
HLIST_HEAD(head);
- if (!kmem_alloc_batch(&head, obj_cache, __GFP_HIGH | __GFP_NOWARN))
+ /*
+ * Allow reclaim only in preemptible context and during
+ * early boot. If not preemptible, the caller might hold
+ * locks causing a deadlock in the allocator.
+ *
+ * If the reclaim flag is not set during early boot then
+ * allocations, which happen before deferred page
+ * initialization has completed, will fail.
+ *
+ * In preemptible context the flag is harmless and not a
+ * performance issue as that's usually invoked from slow
+ * path initialization context.
+ */
+ if (preemptible() || system_state < SYSTEM_SCHEDULING)
+ gfp |= __GFP_KSWAPD_RECLAIM;
+
+ if (!kmem_alloc_batch(&head, obj_cache, gfp))
break;
guard(raw_spinlock_irqsave)(&pool_lock);