Skip to content

Commit

Permalink
nrt: filter: avoid returns mid-flow
Browse files Browse the repository at this point in the history
For better readability and to make the flow more consistent

Signed-off-by: Francesco Romani <fromani@redhat.com>
  • Loading branch information
ffromani committed May 4, 2022
1 parent aa55171 commit 59d7a04
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/noderesourcetopology/filter.go
Expand Up @@ -81,8 +81,9 @@ func resourcesAvailableInAnyNUMANodes(logKey string, numaNodes NUMANodeList, res
// some resources may not expose NUMA affinity (device plugins, extended resources), but all resources
// must be reported at node level; thus, if they are not present at node level, we can safely assume
// we don't have the resource at all.
klog.V(5).InfoS("early verdict", "logKey", logKey, "node", nodeName, "resource", resource, "suitable", "false")
return false
klog.V(5).InfoS("short circuit", "logKey", logKey, "node", nodeName, "resource", resource)
bitmask.Clear()
break
}

// for each requested resource, calculate which NUMA slots are good fits, and then AND with the aggregated bitmask, IOW unset appropriate bit if we can't align resources, or set it
Expand All @@ -98,8 +99,9 @@ func resourcesAvailableInAnyNUMANodes(logKey string, numaNodes NUMANodeList, res
}
bitmask.And(resourceBitmask)
if bitmask.IsEmpty() {
klog.V(5).InfoS("early verdict", "logKey", logKey, "node", nodeName, "resource", resource, "suitable", "false")
return false
klog.V(5).InfoS("short circuit", "logKey", logKey, "node", nodeName, "resource", resource)
bitmask.Clear()
break
}
}
ret := !bitmask.IsEmpty()
Expand Down

0 comments on commit 59d7a04

Please sign in to comment.