Browse Source

qcacmn: Mitigate the slab allocation failures with __GFP_DIRECT_RECLAIM

__qdf_nbuf_frag_alloc fallback allocation using alloc_skb slab
allocation, use GFP_KERNEL flag which is inclusive of
__GFP_DIRECT_RECLAIM. This will mitigate the allocation failures.

Change-Id: Ib852bf0f812839f0a99093855cebc928d0c79fd1
CRs-Fixed: 3585716
Prakash Manjunathappa 1 year ago
parent
commit
fb7d334b7c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      qdf/linux/src/qdf_nbuf.c

+ 5 - 0
qdf/linux/src/qdf_nbuf.c

@@ -629,11 +629,13 @@ struct sk_buff *__qdf_nbuf_frag_alloc(qdf_device_t osdev, size_t size,
 {
 	struct sk_buff *skb;
 	int flags = GFP_KERNEL & ~__GFP_DIRECT_RECLAIM;
+	bool atomic = false;
 
 	if (align)
 		size += (align - 1);
 
 	if (in_interrupt() || irqs_disabled() || in_atomic()) {
+		atomic = true;
 		flags = GFP_ATOMIC;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
 		/*
@@ -651,6 +653,9 @@ struct sk_buff *__qdf_nbuf_frag_alloc(qdf_device_t osdev, size_t size,
 		goto skb_alloc;
 
 	/* 32k page frag alloc failed, try page slab allocation */
+	if (likely(!atomic))
+		flags |= __GFP_DIRECT_RECLAIM;
+
 	skb = alloc_skb(size, flags);
 	if (skb)
 		goto skb_alloc;