optimize the logic of cpu allocation #501
Merged
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.
cache cloud那边有个需求,希望让同一台机器上的所有redis共享同一个核心来做bgsave,所以core里加入了一个配置项叫“maxshare”,限制最大的碎片核数。
不过在分配cpu的时候,core会把所有剩余pieces为0的核划分为碎片核,这样就会导致如下问题:对于一个四核的node,如果core设置了
maxshare=1
,那么在分配了一个带--cpu-bind --cpu=1.1
的workload之后,再申请创建同样的workload会提示资源不足。原因是在第一个workload分配之后,有一个核剩余pieces是0,被识别为碎片核,core就不会再分配新的碎片核了。所以改动了一下这里的逻辑,对于pieces为0的核,不再视为碎片核。