diff for duplicates of <20100713102047.2835.28057.sendpatchset@danny.redhat> diff --git a/a/1.txt b/N1/1.txt index 5999da0..23317b1 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -186,9 +186,3 @@ index f24560c..dfc2dfe 100644 static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) -- 1.7.1.1 - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> diff --git a/a/content_digest b/N1/content_digest index 246df37..a6d1494 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -203,12 +203,6 @@ " \n" " static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)\n" "-- \n" - "1.7.1.1\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" + 1.7.1.1 -bd5e770e900b5a5fa02d5c4199cdb097090f86d2bed672bafc7869654a4c5138 +2f786e2b69917bc919e68031e91d0d873ff82d19743967745c6de11d4da144ba
diff --git a/a/1.txt b/N2/1.txt index 5999da0..8b13789 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -1,194 +1 @@ ->From 15437174f171e197ecdfa5fe71ae89334bb58fd2 Mon Sep 17 00:00:00 2001 -From: Xiaotian Feng <dfeng@redhat.com> -Date: Tue, 13 Jul 2010 13:07:28 +0800 -Subject: [PATCH 21/30] netvm: skb processing -In order to make sure emergency packets receive all memory needed to proceed -ensure processing of emergency SKBs happens under PF_MEMALLOC. - -Use the (new) sk_backlog_rcv() wrapper to ensure this for backlog processing. - -Skip taps, since those are user-space again. - -Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> -Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> -Signed-off-by: Xiaotian Feng <dfeng@redhat.com> ---- - include/net/sock.h | 5 ++++ - net/core/dev.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++--- - net/core/sock.c | 16 +++++++++++++++ - 3 files changed, 72 insertions(+), 4 deletions(-) - -diff --git a/include/net/sock.h b/include/net/sock.h -index ac87f6f..aadf15c 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -680,8 +680,13 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s - return 0; - } - -+extern int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb); -+ - static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) - { -+ if (skb_emergency(skb)) -+ return __sk_backlog_rcv(sk, skb); -+ - return sk->sk_backlog_rcv(sk, skb); - } - -diff --git a/net/core/dev.c b/net/core/dev.c -index e85cc5f..7169b9b 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -2801,6 +2801,7 @@ static int __netif_receive_skb(struct sk_buff *skb) - struct net_device *orig_or_bond; - int ret = NET_RX_DROP; - __be16 type; -+ unsigned long pflags = current->flags; - - if (!netdev_tstamp_prequeue) - net_timestamp_check(skb); -@@ -2808,9 +2809,21 @@ static int __netif_receive_skb(struct sk_buff *skb) - if (vlan_tx_tag_present(skb) && vlan_hwaccel_do_receive(skb)) - return NET_RX_SUCCESS; - -+ /* Emergency skb are special, they should -+ * - be delivered to SOCK_MEMALLOC sockets only -+ * - stay away from userspace -+ * - have bounded memory usage -+ * -+ * Use PF_MEMALLOC as a poor mans memory pool - the grouping kind. -+ * This saves us from propagating the allocation context down to all -+ * allocation sites. -+ */ -+ if (skb_emergency(skb)) -+ current->flags |= PF_MEMALLOC; -+ - /* if we've gotten here through NAPI, check netpoll */ - if (netpoll_receive_skb(skb)) -- return NET_RX_DROP; -+ goto out; - - if (!skb->skb_iif) - skb->skb_iif = skb->dev->ifindex; -@@ -2852,6 +2865,9 @@ static int __netif_receive_skb(struct sk_buff *skb) - } - #endif - -+ if (skb_emergency(skb)) -+ goto skip_taps; -+ - list_for_each_entry_rcu(ptype, &ptype_all, list) { - if (ptype->dev == null_or_orig || ptype->dev == skb->dev || - ptype->dev == orig_dev) { -@@ -2861,13 +2877,17 @@ static int __netif_receive_skb(struct sk_buff *skb) - } - } - -+skip_taps: - #ifdef CONFIG_NET_CLS_ACT - skb = handle_ing(skb, &pt_prev, &ret, orig_dev); - if (!skb) -- goto out; -+ goto unlock; - ncls: - #endif - -+ if (!skb_emergency_protocol(skb)) -+ goto drop; -+ - /* Handle special case of bridge or macvlan */ - rx_handler = rcu_dereference(skb->dev->rx_handler); - if (rx_handler) { -@@ -2877,7 +2897,7 @@ ncls: - } - skb = rx_handler(skb); - if (!skb) -- goto out; -+ goto unlock; - } - - /* -@@ -2907,6 +2927,7 @@ ncls: - if (pt_prev) { - ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); - } else { -+drop: - kfree_skb(skb); - /* Jamal, now you will not able to escape explaining - * me how you were going to use this. :-) -@@ -2914,11 +2935,37 @@ ncls: - ret = NET_RX_DROP; - } - --out: -+unlock: - rcu_read_unlock(); -+out: -+ tsk_restore_flags(current, pflags, PF_MEMALLOC); - return ret; - } - -+/* -+ * Filter the protocols for which the reserves are adequate. -+ * -+ * Before adding a protocol make sure that it is either covered by the existing -+ * reserves, or add reserves covering the memory need of the new protocol's -+ * packet processing. -+ */ -+static int skb_emergency_protocol(struct sk_buff *skb) -+{ -+ if (skb_emergency(skb)) -+ switch (skb->protocol) { -+ case __constant_htons(ETH_P_ARP): -+ case __constant_htons(ETH_P_IP): -+ case __constant_htons(ETH_P_IPV6): -+ case __constant_htons(ETH_P_8021Q): -+ break; -+ -+ default: -+ return 0; -+ } -+ -+ return 1; -+} -+ - /** - * netif_receive_skb - process receive buffer from network - * @skb: buffer to process -diff --git a/net/core/sock.c b/net/core/sock.c -index f24560c..dfc2dfe 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -322,6 +322,22 @@ int sk_clear_memalloc(struct sock *sk) - return set; - } - EXPORT_SYMBOL_GPL(sk_clear_memalloc); -+ -+int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) -+{ -+ int ret; -+ unsigned long pflags = current->flags; -+ -+ /* these should have been dropped before queueing */ -+ BUG_ON(!sk_has_memalloc(sk)); -+ -+ current->flags |= PF_MEMALLOC; -+ ret = sk->sk_backlog_rcv(sk, skb); -+ tsk_restore_flags(current, pflags, PF_MEMALLOC); -+ -+ return ret; -+} -+EXPORT_SYMBOL(__sk_backlog_rcv); - #endif - - static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) --- -1.7.1.1 - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> diff --git a/a/content_digest b/N2/content_digest index 246df37..28812e3 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -16,199 +16,5 @@ " davem@davemloft.net\0" "\00:1\0" "b\0" - ">From 15437174f171e197ecdfa5fe71ae89334bb58fd2 Mon Sep 17 00:00:00 2001\n" - "From: Xiaotian Feng <dfeng@redhat.com>\n" - "Date: Tue, 13 Jul 2010 13:07:28 +0800\n" - "Subject: [PATCH 21/30] netvm: skb processing\n" - "\n" - "In order to make sure emergency packets receive all memory needed to proceed\n" - "ensure processing of emergency SKBs happens under PF_MEMALLOC.\n" - "\n" - "Use the (new) sk_backlog_rcv() wrapper to ensure this for backlog processing.\n" - "\n" - "Skip taps, since those are user-space again.\n" - "\n" - "Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>\n" - "Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>\n" - "Signed-off-by: Xiaotian Feng <dfeng@redhat.com>\n" - "---\n" - " include/net/sock.h | 5 ++++\n" - " net/core/dev.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++---\n" - " net/core/sock.c | 16 +++++++++++++++\n" - " 3 files changed, 72 insertions(+), 4 deletions(-)\n" - "\n" - "diff --git a/include/net/sock.h b/include/net/sock.h\n" - "index ac87f6f..aadf15c 100644\n" - "--- a/include/net/sock.h\n" - "+++ b/include/net/sock.h\n" - "@@ -680,8 +680,13 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s\n" - " \treturn 0;\n" - " }\n" - " \n" - "+extern int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);\n" - "+\n" - " static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)\n" - " {\n" - "+\tif (skb_emergency(skb))\n" - "+\t\treturn __sk_backlog_rcv(sk, skb);\n" - "+\n" - " \treturn sk->sk_backlog_rcv(sk, skb);\n" - " }\n" - " \n" - "diff --git a/net/core/dev.c b/net/core/dev.c\n" - "index e85cc5f..7169b9b 100644\n" - "--- a/net/core/dev.c\n" - "+++ b/net/core/dev.c\n" - "@@ -2801,6 +2801,7 @@ static int __netif_receive_skb(struct sk_buff *skb)\n" - " \tstruct net_device *orig_or_bond;\n" - " \tint ret = NET_RX_DROP;\n" - " \t__be16 type;\n" - "+\tunsigned long pflags = current->flags;\n" - " \n" - " \tif (!netdev_tstamp_prequeue)\n" - " \t\tnet_timestamp_check(skb);\n" - "@@ -2808,9 +2809,21 @@ static int __netif_receive_skb(struct sk_buff *skb)\n" - " \tif (vlan_tx_tag_present(skb) && vlan_hwaccel_do_receive(skb))\n" - " \t\treturn NET_RX_SUCCESS;\n" - " \n" - "+\t/* Emergency skb are special, they should\n" - "+\t * - be delivered to SOCK_MEMALLOC sockets only\n" - "+\t * - stay away from userspace\n" - "+\t * - have bounded memory usage\n" - "+\t *\n" - "+\t * Use PF_MEMALLOC as a poor mans memory pool - the grouping kind.\n" - "+\t * This saves us from propagating the allocation context down to all\n" - "+\t * allocation sites.\n" - "+\t */\n" - "+\tif (skb_emergency(skb))\n" - "+\t\tcurrent->flags |= PF_MEMALLOC;\n" - "+\n" - " \t/* if we've gotten here through NAPI, check netpoll */\n" - " \tif (netpoll_receive_skb(skb))\n" - "-\t\treturn NET_RX_DROP;\n" - "+\t\tgoto out;\n" - " \n" - " \tif (!skb->skb_iif)\n" - " \t\tskb->skb_iif = skb->dev->ifindex;\n" - "@@ -2852,6 +2865,9 @@ static int __netif_receive_skb(struct sk_buff *skb)\n" - " \t}\n" - " #endif\n" - " \n" - "+\tif (skb_emergency(skb))\n" - "+\t\tgoto skip_taps;\n" - "+\n" - " \tlist_for_each_entry_rcu(ptype, &ptype_all, list) {\n" - " \t\tif (ptype->dev == null_or_orig || ptype->dev == skb->dev ||\n" - " \t\t ptype->dev == orig_dev) {\n" - "@@ -2861,13 +2877,17 @@ static int __netif_receive_skb(struct sk_buff *skb)\n" - " \t\t}\n" - " \t}\n" - " \n" - "+skip_taps:\n" - " #ifdef CONFIG_NET_CLS_ACT\n" - " \tskb = handle_ing(skb, &pt_prev, &ret, orig_dev);\n" - " \tif (!skb)\n" - "-\t\tgoto out;\n" - "+\t\tgoto unlock;\n" - " ncls:\n" - " #endif\n" - " \n" - "+\tif (!skb_emergency_protocol(skb))\n" - "+\t\tgoto drop;\n" - "+\n" - " \t/* Handle special case of bridge or macvlan */\n" - " \trx_handler = rcu_dereference(skb->dev->rx_handler);\n" - " \tif (rx_handler) {\n" - "@@ -2877,7 +2897,7 @@ ncls:\n" - " \t\t}\n" - " \t\tskb = rx_handler(skb);\n" - " \t\tif (!skb)\n" - "-\t\t\tgoto out;\n" - "+\t\t\tgoto unlock;\n" - " \t}\n" - " \n" - " \t/*\n" - "@@ -2907,6 +2927,7 @@ ncls:\n" - " \tif (pt_prev) {\n" - " \t\tret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);\n" - " \t} else {\n" - "+drop:\n" - " \t\tkfree_skb(skb);\n" - " \t\t/* Jamal, now you will not able to escape explaining\n" - " \t\t * me how you were going to use this. :-)\n" - "@@ -2914,11 +2935,37 @@ ncls:\n" - " \t\tret = NET_RX_DROP;\n" - " \t}\n" - " \n" - "-out:\n" - "+unlock:\n" - " \trcu_read_unlock();\n" - "+out:\n" - "+\ttsk_restore_flags(current, pflags, PF_MEMALLOC);\n" - " \treturn ret;\n" - " }\n" - " \n" - "+/*\n" - "+ * Filter the protocols for which the reserves are adequate.\n" - "+ *\n" - "+ * Before adding a protocol make sure that it is either covered by the existing\n" - "+ * reserves, or add reserves covering the memory need of the new protocol's\n" - "+ * packet processing.\n" - "+ */\n" - "+static int skb_emergency_protocol(struct sk_buff *skb)\n" - "+{\n" - "+\tif (skb_emergency(skb))\n" - "+\t\tswitch (skb->protocol) {\n" - "+\t\tcase __constant_htons(ETH_P_ARP):\n" - "+\t\tcase __constant_htons(ETH_P_IP):\n" - "+\t\tcase __constant_htons(ETH_P_IPV6):\n" - "+\t\tcase __constant_htons(ETH_P_8021Q):\n" - "+\t\t\tbreak;\n" - "+\n" - "+\t\tdefault:\n" - "+\t\t\treturn 0;\n" - "+\t\t}\n" - "+\n" - "+\treturn 1;\n" - "+}\n" - "+\n" - " /**\n" - " *\tnetif_receive_skb - process receive buffer from network\n" - " *\t@skb: buffer to process\n" - "diff --git a/net/core/sock.c b/net/core/sock.c\n" - "index f24560c..dfc2dfe 100644\n" - "--- a/net/core/sock.c\n" - "+++ b/net/core/sock.c\n" - "@@ -322,6 +322,22 @@ int sk_clear_memalloc(struct sock *sk)\n" - " \treturn set;\n" - " }\n" - " EXPORT_SYMBOL_GPL(sk_clear_memalloc);\n" - "+\n" - "+int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)\n" - "+{\n" - "+\tint ret;\n" - "+\tunsigned long pflags = current->flags;\n" - "+\n" - "+\t/* these should have been dropped before queueing */\n" - "+\tBUG_ON(!sk_has_memalloc(sk));\n" - "+\n" - "+\tcurrent->flags |= PF_MEMALLOC;\n" - "+\tret = sk->sk_backlog_rcv(sk, skb);\n" - "+\ttsk_restore_flags(current, pflags, PF_MEMALLOC);\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+EXPORT_SYMBOL(__sk_backlog_rcv);\n" - " #endif\n" - " \n" - " static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)\n" - "-- \n" - "1.7.1.1\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" -bd5e770e900b5a5fa02d5c4199cdb097090f86d2bed672bafc7869654a4c5138 +0f9ce5c304345ef177263032de946d04f5497d86bef378a302da1f51ba20e647
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.