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:
parent
e59a59bddc
commit
a0045b428f
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user