diff --git a/src/rm_allocator.c b/src/rm_allocator.c
index 241df5dce2d5d8f92fa366dc46e9b7b126e2918d..50beaa526e7e087301b410d7915894d0ce2cb8ed 100644 (file)
--- a/src/rm_allocator.c
+++ b/src/rm_allocator.c
@@ -503,11 +503,11 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
if (matchingNode) {
matchingEnd = matchingNode->base + matchingNode->length - 1;
findEnd = findNode.base + findNode.length - 1;
+ nodePassesPolicy = RM_BOOL_UNDEF;
if ((matchingNode->allocationCount == 0) &&
(findNode.base >= matchingNode->base) && (findEnd <= matchingEnd)) {
/* Attempt to preallocate from node only if not owned by anyone and sits
* within a matching node. */
- nodePassesPolicy = RM_FALSE;
policyCheckCfg.type = policyCheckType;
policyCheckCfg.validInstNode = opInfo->serviceSrcInstNode;
policyCheckCfg.resourceBase = findNode.base;
@@ -567,11 +567,17 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
findNode.base = matchingNode->base;
}
else {
- if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
- findNode.base = nextNode->base;
+ if (!nodePassesPolicy) {
+ findNode.base += findNode.length;
}
else {
- retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET;
+ /* Matching node allocated, move to next node */
+ if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
+ findNode.base = nextNode->base;
+ }
+ else {
+ retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET;
+ }
}
}
}