On Mon, Aug 22, 2011 at 7:02 AM, Pravin Shelar <pshe...@nicira.com> wrote:
> On Sat, Aug 20, 2011 at 4:31 AM, Jesse Gross <je...@nicira.com> wrote:
>> On Sat, Aug 20, 2011 at 4:49 AM, Pravin Shelar <pshe...@nicira.com> wrote:
>>> +int tnl_init()
>>> +{
>>> +       port_table = alloc_buckets(port_table_size);
>>> +       if (!port_table)
>>> +               return -ENOMEM;
>>
>> Previously we would allocate the hash table when the first tunnel port
>> was created but now we're doing it as soon as the module is loaded.
>> Why the change?  Short of a compelling reason, I think it's better to
>> do it on demand, otherwise we are consuming resources for something
>> that will potentially never get used.
>
> it saves port_table null check in lookup which i think is worth two
> pages of preallocation.

I don't think there is a performance argument to be made here.  The
branch predictor will quickly learn that port_table is non-NULL and
the cost of that check will be essentially nothing.  I think really
the only real consideration is cleanliness and simplification.  For
reference, the rest of the tunneling code (GRE and CAPWAP) is moving
to registration on first use.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to