fix: adjust hints to avoid affinity error if not restricted - #9
Open
junyu-peng wants to merge 43 commits into
Open
fix: adjust hints to avoid affinity error if not restricted#9junyu-peng wants to merge 43 commits into
junyu-peng wants to merge 43 commits into
Conversation
…pool to boolean Update the resource package conversion logic to represent pinned cpuset as a boolean flag instead of a pool name Modify test cases to reflect the new pinned cpuset representation
- Fix race condition in Start() by properly handling started flag and stop channel - Replace sleep-based test synchronization with channel signaling - Ensure cpuPressureEviction only runs when policy is started
…e PinnedCPUSetInfo - Remove PinnedCPUSetInfo and related fields from QoSRegion interfaces - Add GetResourcePackageName method to QoSRegion interface - Introduce ResourcePackageConfig type for storing pinned cpuset info - Update CPU server to handle resource package config from advisor requests - Refactor region assembly to use resource package config from metacache - Simplify region creation by removing pinnedCPUSetInfo parameter - Add comprehensive tests for resource package config handling
Move zone attribute names used in topology adapter to a centralized consts package to maintain consistency between CNR producers and consumers. Update all references to use the new constants from pkg/consts.
…n pools split the pool allocation logic into separate functions for pinned and common pools add comprehensive tests for various allocation scenarios remove redundant pinned CPU set parameter from generatePoolsAndIsolation
…support Add resource package name handling in region creation and metrics Modify CPU allocation logic to consider resource package pinned CPUs
… package Consider resource package when setting origin owner pool name for numa binding containers. This ensures proper pool name wrapping when a resource package is specified and valid.
…pu allocation logic remove redundant unwrap operation in GetResourcePackageName and use annotations directly modify cpu allocation to consider pinned cpusets for better resource isolation
…utes add attribute selector to filter resource packages for IRQ forbidden CPUs add helper function to convert CNR attributes to string map add utility function to aggregate pinned CPU sets from matching resource packages update IRQ forbidden core logic to include resource package pinned CPUs add tests for new functionality
…ated logic Add attributes map to ResourcePackageItemConfig proto message to store additional package metadata. Refactor state management to use ResourcePackageState struct instead of direct CPUSet maps. Update sync logic to handle attributes and improve IRQ forbidden cores calculation. Modify tests to accommodate new state structure and attribute handling.
…ibutes - Replace direct CPUSet storage with ResourcePackageState struct to support additional attributes - Add proper nil checks when accessing resource package states - Update all related test cases to use the new structure
add utility functions to handle resource package states and implement logic to exclude non-reclaimable pinned CPUs from reclaim pool add disable-reclaim selector configuration and update CPU assembler to consider non-reclaimable packages extend tests for resource package utilities and policy advisor handler
Add detailed logging to track resource package state changes in CPU dynamic policy
…butes - Store attributes for non-pinned resource packages - Fix pinned package detection by tracking pinned packages separately - Ensure proper CPU allocation for mixed pinned/non-pinned packages
add detailed logging to track cpu pool size calculations and resource package config updates
Add detailed InfoS logging in generateReclaimBlockCPUSet and generateBlockCPUSet functions to track CPU allocation process. This helps in debugging NUMA-aware and non-NUMA-aware block allocation scenarios by logging key variables and their states during execution.
add ParseSelector helper function to parse label selectors from strings add tests for ParseSelector function update callers to use new ParseSelector function instead of direct parsing change DisableReclaimPinnedCPUSetResourcePackageSelector to string type
Ensure the cpu set is not empty before wrapping the owner pool name with the resource package name to avoid unnecessary pool name modifications.
Implement support for cpuset partition flags in cgroupv2, including root, member and isolated partitions. Add new ApplyCPUSetPartition method to Manager interface and implement it for fake, v1 and v2 managers. Also add corresponding test cases.
remove isReclaimedOrSharedQoS parameter and improve handling of different QoS levels use aggregated pod request for shared/reclaimed cores with NUMA binding add support for decimal CPU quantities in topology annotations
Restructure CPU allocation logic to properly handle resource package pinning at NUMA level Add test cases for various resource package pinning scenarios
…cation - Rename isReclaimBlock to isSharedBlock for clarity and better semantics - Refactor allocateDedicatedBlocks to handle CPU availability checks more robustly - Improve NUMA-binding share pool handling and isolation pool priority - Update reclaim block allocation to properly respect NUMA boundaries - Add comprehensive test cases for various allocation scenarios
Include NUMA topology assignments in the memory allocation response to provide detailed NUMA-aware allocation information.
Include NUMA node to CPU set size mapping in the resource allocation response to provide topology awareness information to the caller.
…ware resources response
…tion The logic for handling CPU allocation with resource package pinning has been restructured to be more straightforward. The nested conditions are flattened to clearly separate the two cases: when the current RP has pinned CPUs, and when we need to exclude other RPs' pinned CPUs.
Add additional logging to track CPU pool allocation details including package-specific information and common pool quantities. This helps in troubleshooting allocation issues.
The fields were not being used in the resourcePackageHintOptimizer struct and could be safely removed to simplify the code structure.
…and allocated sets Use the union of DefaultCPUSet and AllocatedCPUSet when calculating available CPUs for unpinned pods to handle disjoint CPU sets properly. Update tests to reflect the new calculation logic.
implement allocation hooks mechanism to allow pre-update validation and modification of allocation info add tests for allocation hooks functionality update all state modification calls to use the new hook-instrumented update method
…d allocation info Pass originAllocationInfo to updateAllocationInfo to avoid redundant state lookups
…configuration - Add ExportedAllocationInfoAnnotationKeys field to GenericQRMPluginOptions and GenericQRMPluginConfiguration to support filtering annotations in allocation responses. - Rename IsInMemoryStore to EnableInMemoryState in GenericQRMPluginConfiguration to align with naming conventions and clarify its purpose. - Update NewGenericQRMPluginOptions and ApplyTo methods to handle the new configuration field.
… annotations - Add GetPodAggregatedRequestResourceByAnnotations to provide flexible resource request extraction from pod annotations with fallback support. - Add GetExportedAllocationInfoAnnotationKeys and GetExportedAnnotations to filter and extract specific annotations from AllocationInfo for ResourceAllocationResponse. - Refactor GetPodAggregatedRequestResource to utilize the new annotation-based extraction logic. - Add comprehensive unit tests for the new utility functions in util_test.go.
- Refactor DynamicPolicy to support Allocation Hooks by introducing updateAllocationInfo and invokeAllocationHooksForPodResourceEntries. - Eliminate redundant locking in invokeAllocationHooks to prevent potential deadlocks as the caller usually holds the lock. - Update PackAllocationResponse and GetCPUTopologyAllocationsAnnotations in cpu/util to support pre-filtered annotations and more flexible resource extraction. - Enhance cpu/util with IsTopologyAllocationChanged to detect changes in physical CPU assignments or quantities. - Update CPU allocation handlers to filter annotations exported to Kubelet based on configuration. - Add unit tests for new utility functions and update policy tests to include hook registration and annotation filtering configuration.
- Refactor Memory DynamicPolicy to support Allocation Hooks, aligning with the CPU plugin's refactoring logic. - Introduce updateAllocationInfo to centralize state updates and hook execution, and fix potential deadlock issues by removing redundant locks. - Implement getPackAllocationResponse to standardize annotation filtering for all memory-related resources in the allocation response. - Add IsTopologyAllocationChanged and memory-specific annotation helpers in memory/dynamicpolicy/util. - Enhance unit tests with dedicated cases for AllocationHooks and update test initialization to match production behavior.
extract and properly map topology aware allocations into the resource allocation info struct, making the topology allocation data visible in the pluginapi response
…-linux versions Move the cgroup-v1/v2 dependent handleAdvisorMemoryHot implementation to platform-specific files to support cross-compilation on non-linux systems
Extend the CPU dynamic policy's GetResourcesAllocation method to include topology assignments in the returned resource allocation response, populating the count of allocated CPUs per NUMA node.
luomingmeng
force-pushed
the
dev/resource-package-test
branch
from
May 15, 2026 10:27
41925c6 to
cf54ad4
Compare
junyu-peng
force-pushed
the
dev/sriov-hints
branch
from
May 18, 2026 06:07
d3c9735 to
5b8488b
Compare
luomingmeng
force-pushed
the
dev/resource-package-test
branch
from
May 20, 2026 07:32
cf54ad4 to
284625f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Bug fixes
What this PR does / why we need it:
adjust hints to avoid affinity error if not restricted
Which issue(s) this PR fixes:
Special notes for your reviewer: