Skip to content

Commit

Permalink
qrm cpu & memory plugin support set numa binding numa id to allocatio…
Browse files Browse the repository at this point in the history
…n state for shared or dedicated numa binding without exclusive pods
  • Loading branch information
luomingmeng committed Oct 15, 2024
1 parent 7183320 commit e1a84d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ func (p *DynamicPolicy) dedicatedCoresWithNUMABindingAllocationHandler(ctx conte
RequestQuantity: reqFloat64,
}

if !qosutil.AnnotationsIndicateNUMAExclusive(req.Annotations) {
if result.Size() != 1 {
return nil, fmt.Errorf("numa binding without numa exclusive allocation result numa node size is %d, "+
"not equal to 1", result.Size())
}
allocationInfo.SetSpecifiedNUMABindingNUMAID(result.ToSliceNoSortUInt64()[0])
}

// update pod entries directly.
// if one of subsequent steps is failed, we will delete current allocationInfo from podEntries in defer function of allocation function.
p.state.SetAllocationInfo(allocationInfo.PodUid, allocationInfo.ContainerName, allocationInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ func (p *DynamicPolicy) numaBindingAllocationHandler(ctx context.Context,
NumaAllocationResult: result.Clone(),
TopologyAwareAllocations: topologyAwareAllocations,
}

if !qosutil.AnnotationsIndicateNUMAExclusive(req.Annotations) {
if result.Size() != 1 {
return nil, fmt.Errorf("numa binding without numa exclusive allocation result numa node size is %d, "+
"not equal to 1", result.Size())
}
allocationInfo.SetSpecifiedNUMABindingNUMAID(result.ToSliceNoSortUInt64()[0])
}

p.state.SetAllocationInfo(v1.ResourceMemory, req.PodUid, req.ContainerName, allocationInfo)

podResourceEntries = p.state.GetPodResourceEntries()
Expand Down

0 comments on commit e1a84d6

Please sign in to comment.