2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 13:58:14 +00:00

datapath-windows: Percpu allocation support function

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Sorin Vinturis 2016-03-25 14:49:26 +00:00 committed by Ben Pfaff
parent e59a59bddc
commit a0045b428f
2 changed files with 17 additions and 0 deletions

View File

@ -116,3 +116,19 @@ OvsCompareString(PVOID string1, PVOID string2)
RtlInitString(&str2, string2);
return RtlEqualString(&str1, &str2, FALSE);
}
VOID *
OvsAllocateMemoryPerCpu(size_t size, ULONG tag)
{
VOID *ptr = NULL;
ULONG count = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
ASSERT(KeQueryActiveGroupCount() == 1);
ptr = OvsAllocateMemoryWithTag(count * size, tag);
if (ptr) {
RtlZeroMemory(ptr, count * size);
}
return ptr;
}

View File

@ -40,6 +40,7 @@
VOID *OvsAllocateMemory(size_t size);
VOID *OvsAllocateMemoryWithTag(size_t size, ULONG tag);
VOID *OvsAllocateAlignedMemory(size_t size, UINT16 align);
VOID *OvsAllocateMemoryPerCpu(size_t size, ULONG tag);
VOID OvsFreeMemory(VOID *ptr);
VOID OvsFreeMemoryWithTag(VOID *ptr, ULONG tag);
VOID OvsFreeAlignedMemory(VOID *ptr);