Skip to content

Commit

Permalink
datapath-windows: Added specific pool tag for event code
Browse files Browse the repository at this point in the history
All memory allocations within event code have 'ESVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: openvswitch/ovs-issues#56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
svinturis authored and blp committed Mar 26, 2015
1 parent 48b3e64 commit 8472609
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions datapath-windows/ovsext/Event.c
Expand Up @@ -96,9 +96,9 @@ OvsCleanupEvent(POVS_OPEN_INSTANCE instance)

LIST_FORALL_SAFE(&queue->elemList, link, next) {
elem = CONTAINING_RECORD(link, OVS_EVENT_QUEUE_ELEM, link);
OvsFreeMemory(elem);
OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
}
OvsFreeMemory(queue);
OvsFreeMemoryWithTag(queue, OVS_EVENT_POOL_TAG);
}
}

Expand Down Expand Up @@ -139,7 +139,8 @@ OvsPostEvent(UINT32 portNo,
portNo == OVS_DEFAULT_PORT_NO) {
queue->pollAll = TRUE;
} else {
elem = (POVS_EVENT_QUEUE_ELEM)OvsAllocateMemory(sizeof(*elem));
elem = (POVS_EVENT_QUEUE_ELEM)OvsAllocateMemoryWithTag(
sizeof(*elem), OVS_EVENT_POOL_TAG);
if (elem == NULL) {
queue->pollAll = TRUE;
} else {
Expand All @@ -158,7 +159,7 @@ OvsPostEvent(UINT32 portNo,
LIST_FORALL_SAFE(&queue->elemList, curr, next) {
RemoveEntryList(curr);
elem = CONTAINING_RECORD(curr, OVS_EVENT_QUEUE_ELEM, link);
OvsFreeMemory(elem);
OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
}
queue->numElems = 0;
}
Expand Down Expand Up @@ -243,7 +244,8 @@ OvsSubscribeEventIoctl(PFILE_OBJECT fileObject,
}

if (request->subscribe) {
queue = (POVS_EVENT_QUEUE)OvsAllocateMemory(sizeof (OVS_EVENT_QUEUE));
queue = (POVS_EVENT_QUEUE)OvsAllocateMemoryWithTag(
sizeof(OVS_EVENT_QUEUE), OVS_EVENT_POOL_TAG);
if (queue == NULL) {
status = STATUS_NO_MEMORY;
OVS_LOG_WARN("Fail to allocate event queue");
Expand Down Expand Up @@ -284,9 +286,9 @@ OvsSubscribeEventIoctl(PFILE_OBJECT fileObject,
}
LIST_FORALL_SAFE(&queue->elemList, link, next) {
elem = CONTAINING_RECORD(link, OVS_EVENT_QUEUE_ELEM, link);
OvsFreeMemory(elem);
OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
}
OvsFreeMemory(queue);
OvsFreeMemoryWithTag(queue, OVS_EVENT_POOL_TAG);
} else {
OvsReleaseEventQueueLock();
}
Expand Down Expand Up @@ -446,7 +448,7 @@ OvsRemoveEventEntry(POVS_OPEN_INSTANCE instance,
elem = (POVS_EVENT_QUEUE_ELEM)RemoveHeadList(&queue->elemList);
entry->portNo = elem->portNo;
entry->status = elem->status;
OvsFreeMemory(elem);
OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
queue->numElems--;
status = STATUS_SUCCESS;
}
Expand Down
1 change: 1 addition & 0 deletions datapath-windows/ovsext/Util.h
Expand Up @@ -25,6 +25,7 @@
#define OVS_OTHER_POOL_TAG 'MSVO'
#define OVS_MDL_POOL_TAG 'BSVO'
#define OVS_DATAPATH_POOL_TAG 'DSVO'
#define OVS_EVENT_POOL_TAG 'ESVO'

VOID *OvsAllocateMemory(size_t size);
VOID *OvsAllocateMemoryWithTag(size_t size, ULONG tag);
Expand Down

0 comments on commit 8472609

Please sign in to comment.