powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation
PATCH 1/1 powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation
From: Mohammad Shahid <[email protected]>
The DTL buffer is allocated while holding dtl_global_lock, which is spinlock.
GFP_KERNEL allow direct memory reclaim and may sleep. Combining GFP_KERNEL with GFP_ATOMIC does not remove the direct reclaim.
Use GFP_ATOMIC alone to ensure the allocation does not sleep while the spinlock is held.
The issue is reported by script coccinelle call_kern.cocci.
--- arch/powerpc/perf/vpa-dtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/vpa-dtl.c +1 -1
@@ -338,7 +338,7 @@ static int vpa_dtl_mem_alloc(int cpu)if (!dtl_cache)return -ENOMEM ; - buf =kmem_cache_alloc_node (dtl_cache,GFP_KERNEL |GFP_ATOMIC ,cpu_to_node (cpu)); + buf =kmem_cache_alloc_node (dtl_cache,GFP_ATOMIC ,cpu_to_node (cpu));if (!buf) {pr_warn ("buffer allocation failed for cpu %d\n" , cpu);return -ENOMEM ;
Signature · 1 line
2.43.0
Hi,
Could you please review this patch and give your feedback,when time permits.
Thanks
Shahid.
Quoted 36 lines · On 2026-11-02 20:07 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
The DTL buffer is allocated while holding
dtl_global_lock, which is spinlock.
GFP_KERNELallow direct memory reclaim and may sleep. CombiningGFP_KERNELwithGFP_ATOMICdoes not remove the direct reclaim.Use
GFP_ATOMICalone to ensure the allocation does not sleep while the spinlock is held.The issue is reported by script coccinelle
call_kern.cocci.Signed-off-by Mohammad Shahid <[email protected]>--- arch/powerpc/perf/vpa-dtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/perf/vpa-dtl.c +1
-1@@ -338,7 +338,7 @@ static int vpa_dtl_mem_alloc(int cpu)if (!dtl_cache)return -ENOMEM ; - buf =kmem_cache_alloc_node (dtl_cache,GFP_KERNEL |GFP_ATOMIC ,cpu_to_node (cpu)); + buf =kmem_cache_alloc_node (dtl_cache,GFP_ATOMIC ,cpu_to_node (cpu));if (!buf) {pr_warn ("buffer allocation failed for cpu %d\n" , cpu);return -ENOMEM ;Signature · 1 line
2.43.0
Quoted 8 lines · [email protected] writes:
From: Mohammad Shahid <[email protected]>
The DTL buffer is allocated while holding
dtl_global_lock, which is spinlock.
GFP_KERNELallow direct memory reclaim and may sleep. CombiningGFP_KERNELwithGFP_ATOMICdoes not remove the direct reclaim.
Quoted 6 lines
Use
GFP_ATOMICalone to ensure the allocation does not sleep while the spinlock is held.The issue is reported by script coccinelle
call_kern.cocci.Signed-off-by Mohammad Shahid <[email protected]>
This make sense. However we should also add fixes tag and tag stable so it gets backported to stable trees as well.
LGTM, so feel free to add:
Quoted 10 lines · On Mon, 02 Nov 2026 20:07:19 +0530, [email protected] wrote:
The DTL buffer is allocated while holding
dtl_global_lock, which is spinlock.
GFP_KERNELallow direct memory reclaim and may sleep. CombiningGFP_KERNELwithGFP_ATOMICdoes not remove the direct reclaim.Use
GFP_ATOMICalone to ensure the allocation does not sleep while the spinlock is held.[...]
Applied to powerpc/fixes.
[1/1] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation
https://git.kernel.org/powerpc/c/9500416c8aa7c271b85be6a0d5856da62b60223a
cheers