dev_alloc_skb: avoid using GFP_ATOMIC
Subsystems (2)
PATCH 1/1 dev_alloc_skb: avoid using GFP_ATOMIC
From: swalter <swalter@swalter-d630.(none)>
Signed-off-by Steven Walter <[email protected]>
--- net/core/skbuff.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
net/core/skbuff.c +5 -1
@@ -306,7 +306,11 @@ struct sk_buff *dev_alloc_skb(unsigned int length)* There is more code here than it seems: * __dev_alloc_skb is an inline */ -return __dev_alloc_skb (length,GFP_ATOMIC ); +if (in_interrupt () ||in_atomic () ||irqs_disabled ()) { +return __dev_alloc_skb (length,GFP_ATOMIC ); + }else { +return __dev_alloc_skb (length,GFP_KERNEL ); + } }EXPORT_SYMBOL (dev_alloc_skb);
Signature · 1 line
1.6.2.3.g5bbe6
Quoted 15 lines · On Tue, 29 Sep 2009 12:43:13 -0400 [email protected] wrote:
From: swalter <swalter@swalter-d630.(none)>
Signed-off-by Steven Walter <[email protected]>--- net/core/skbuff.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)net/core/skbuff.c +0
-0@@ -306,7 +306,11 @@ struct sk_buff *dev_alloc_skb(unsigned int length)* There is more code here than it seems: * __dev_alloc_skb is an inline
net/core/skbuff.c struct sk_buff *dev_alloc_skb(unsigned int length) · line 316
Quoted 10 lines
net/core/skbuff.c +5
-1*/ -return __dev_alloc_skb (length,GFP_ATOMIC ); +if (in_interrupt () ||in_atomic () ||irqs_disabled ()) { +return __dev_alloc_skb (length,GFP_ATOMIC ); + }else { +return __dev_alloc_skb (length,GFP_KERNEL ); + } }EXPORT_SYMBOL (dev_alloc_skb);
No, this should be fixed by caller (using netdev_alloc_skb) also, it may break cases like swap over NFS that want to get memory when memory pool is low