diff options
author | Mark Brown <broonie@kernel.org> | 2024-11-14 15:36:46 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-11-14 15:36:46 +0000 |
commit | 9a5a75bf1f485e2d109303a996d147b94c5e79c9 (patch) | |
tree | f931f0d17bef0b6ad980aaf3d2d8b874ef2b749c /lib/objpool.c | |
parent | f3f9f0de30a5106078cd610f80eaa6f9386b2186 (diff) | |
parent | 3b7e11a0116c30848d44429650ad80f9cc3bd963 (diff) |
ASoc: simple-mux: Allow to specify an idle-state
Merge series from "Hendrik v. Raven" <h.v.raven@merzmedtech.de>:
This series adds support for the idle-state property from the mux
framework to the simple-mux audio variant. It allows to specify the state
of the mux when it is not in use.
Diffstat (limited to 'lib/objpool.c')
-rw-r--r-- | lib/objpool.c | 18 |
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; |