[ovs-dev] [PATCH 13/15] datapath-windows: Add Core.h

Samuel Ghinet sghinet at cloudbasesolutions.com
Thu Aug 21 22:58:48 UTC 2014


I have just  asked on osronline.
Even though it is not critical now, it will be useful to know for sure :)

[QUOTE]
We an add an additional API like OvsAllocateMemory() which also zeros the memory.
[/QUOTE]
I would sincerely prefer something shorter than an OvsAllocateZeroedMemory :)
Memory allocation is something quite ubiquitous, so perhaps shorter names would make code clearer.

Sam
________________________________________
From: Nithin Raju [nithin at vmware.com]
Sent: Saturday, August 16, 2014 10:09 AM
To: Samuel Ghinet
Cc: dev at openvswitch.org
Subject: Re: [ovs-dev] [PATCH 13/15] datapath-windows: Add Core.h

Sam,
I don't have a strong opinion here. I am fine if you want to change the utility functions in OvsUtil.c to allocate and free the memory. These are different implementations to do the same thing, and not significantly different. If you want to go ahead and make this change, pls. make it in OvsUtil.c and remove the code in let's come up with a series of patches where we define the new memory allocation functions, and change each of the callsites of OvsAllocateMemory() etc, to use the new functions.

Some comments in the meantime:

> +#define OVS_ALLOC(size) ExAllocatePoolWithTag(NonPagedPool, size, OVS_MEMORY_TAG)

We used NdisAllocateMemoryWithTagPriority() since OVS is an NDIS driver. I am not 100% sure if using ExAllocatePoolWithTag() is better or worse than NdisAllocateMemoryWithTagPriority().

> +
> +static __inline VOID* KZAlloc(SIZE_T size)
> +{
> +    VOID* p = OVS_ALLOC(size);
> +    if (!p)
> +    {
> +        return NULL;
> +    }
> +
> +    RtlZeroMemory(p, size);
> +    return p;
> +}

We an add an additional API like OvsAllocateMemory() which also zeros the memory.

thanks,
Nithin



More information about the dev mailing list