diff mbox

[19/31] netvm: filter emergency skbs.

Message ID 1254406105-16336-1-git-send-email-sjayaraman@suse.de
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Suresh Jayaraman Oct. 1, 2009, 2:08 p.m. UTC
From: Peter Zijlstra <a.p.zijlstra@chello.nl> 

Toss all emergency packets not for a SOCK_MEMALLOC socket. This ensures our
precious memory reserve doesn't get stuck waiting for user-space.

The correctness of this approach relies on the fact that networks must be
assumed lossy.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---
 net/core/filter.c |    3 +++
 1 file changed, 3 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: mmotm/net/core/filter.c
===================================================================
--- mmotm.orig/net/core/filter.c
+++ mmotm/net/core/filter.c
@@ -81,6 +81,9 @@  int sk_filter(struct sock *sk, struct sk
 	int err;
 	struct sk_filter *filter;
 
+	if (skb_emergency(skb) && !sk_has_memalloc(sk))
+		return -ENOMEM;
+
 	err = security_sock_rcv_skb(sk, skb);
 	if (err)
 		return err;