[ovs-dev] [PATCH] datapath: Increase maximum allocation size of action list.

Jesse Gross jesse at nicira.com
Fri Feb 22 20:28:14 UTC 2013


The switch to flow based tunneling increased the size of each output
action in the flow action list.  In extreme cases, this can result
in the action list exceeding the maximum buffer size.

This doubles the maximum buffer size to compensate for the increase
in action size.  Since the buffer is potentially very large, it also
switches to vmalloc.  In the common case, most allocations will be
less than a page and vmalloc automatically uses kmalloc in that case.
Therefore, for the majority of situations, this will have no impact.

Bug #15203

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/flow.c |    3 ++-
 datapath/flow.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index b14229f..8ffe4b5 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -39,6 +39,7 @@
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 #include <linux/rculist.h>
+#include <linux/vmalloc.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
 #include <net/ndisc.h>
@@ -207,7 +208,7 @@ struct sw_flow_actions *ovs_flow_actions_alloc(int size)
 	if (size > MAX_ACTIONS_BUFSIZE)
 		return ERR_PTR(-EINVAL);
 
-	sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL);
+	sfa = vmalloc(sizeof(*sfa) + size);
 	if (!sfa)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/datapath/flow.h b/datapath/flow.h
index 6949640..887b6d4 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -194,7 +194,7 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
 int ovs_flow_metadata_from_nlattrs(struct sw_flow *flow, int key_len,
 				   const struct nlattr *attr);
 
-#define MAX_ACTIONS_BUFSIZE	(16 * 1024)
+#define MAX_ACTIONS_BUFSIZE	(32 * 1024)
 #define TBL_MIN_BUCKETS		1024
 
 struct flow_table {
-- 
1.7.10.4




More information about the dev mailing list