summaryrefslogtreecommitdiff
path: root/lib/objpool.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2024-11-13 03:41:59 +0100
committerIngo Molnar <mingo@kernel.org>2024-11-13 03:42:14 +0100
commitabe949ce0f9be943d8762f91e04b8588255f2f70 (patch)
treed479865f75acaa95fefbb20dccc502ca3cbd5d8d /lib/objpool.c
parent035c5e2143f3edceeede1e99ff9cf8979c548dd5 (diff)
parent2d5404caa8c7bb5c4e0435f94b28834ae5456623 (diff)
Merge tag 'v6.12-rc7' into x86/mm, to pick up fixes before applying new patches
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/objpool.c')
-rw-r--r--lib/objpool.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/objpool.c b/lib/objpool.c
index 234f9d0bd081..b998b720c732 100644
--- a/lib/objpool.c
+++ b/lib/objpool.c
@@ -74,15 +74,21 @@ objpool_init_percpu_slots(struct objpool_head *pool, int nr_objs,
* warm caches and TLB hits. in default vmalloc is used to
* reduce the pressure of kernel slab system. as we know,
* mimimal size of vmalloc is one page since vmalloc would
- * always align the requested size to page size
+ * always align the requested size to page size.
+ * but if vmalloc fails or it is not available (e.g. GFP_ATOMIC)
+ * allocate percpu slot with kmalloc.
*/
- if (pool->gfp & GFP_ATOMIC)
- slot = kmalloc_node(size, pool->gfp, cpu_to_node(i));
- else
+ slot = NULL;
+
+ if ((pool->gfp & (GFP_ATOMIC | GFP_KERNEL)) != GFP_ATOMIC)
slot = __vmalloc_node(size, sizeof(void *), pool->gfp,
cpu_to_node(i), __builtin_return_address(0));
- if (!slot)
- return -ENOMEM;
+
+ if (!slot) {
+ slot = kmalloc_node(size, pool->gfp, cpu_to_node(i));
+ if (!slot)
+ return -ENOMEM;
+ }
memset(slot, 0, size);
pool->cpu_slots[i] = slot;