[ovs-dev] [PATCH v2 11/13] datapath: Remove memory allocations from ovs_flow_cmd_execute.

Jarno Rajahalme jrajahalme at nicira.com
Thu Feb 13 16:07:35 UTC 2014


On Feb 12, 2014, at 3:48 PM, Pravin Shelar <pshelar at nicira.com> wrote:

> On Tue, Feb 11, 2014 at 4:07 PM, Jarno Rajahalme <jrajahalme at nicira.com> wrote:
>> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
>> ---
>> datapath/datapath.c |   60 +++++++++++++++++++++++++++------------------------
>> 1 file changed, 32 insertions(+), 28 deletions(-)
>> 
>> diff --git a/datapath/datapath.c b/datapath/datapath.c
>> index a46ceb0..90fdc60 100644
>> --- a/datapath/datapath.c
>> +++ b/datapath/datapath.c
>> @@ -492,14 +492,24 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
>> {
>>        struct ovs_header *ovs_header = info->userhdr;
>>        struct nlattr **a = info->attrs;
>> -       struct sw_flow_actions *acts;
>>        struct sk_buff *packet;
>> -       struct sw_flow *flow;
>>        struct datapath *dp;
>>        struct ethhdr *eth;
>> +       struct sw_flow flow;
>> +       struct {
>> +               struct sw_flow_actions acts;
>> +               u64 buf[512 / sizeof (u64)];
>> +       } sw_acts;
>> +       struct sw_flow_actions *acts;
>>        int len;
>>        int err;
>> 
> 
> I am not sure about stack usage here. Specifically on platforms with
> 4KB stack we can overrun kernel stack.

AFAIK this is only called from user threads. Are they also limited by the kernel stack? Regardless, ‘sw_acts’ can be made smaller, as new space will be allocated if it is not enough. The intention is that most of the time the actions would fit to the stub in the stack. Do you have suggestions for such a size (e.g., some VLAN manipulations + output to a tunnel)?

  Jarno

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20140213/3c143c5a/attachment-0003.html>


More information about the dev mailing list