Skip to content

Commit

Permalink
engine: Fix NPE when misconfiguring NUMA with hugepages
Browse files Browse the repository at this point in the history
When a VM with NUMA is set with a hugepages with a size
that is different than the one reported by the host, the
running of the VM fails with NPE in NumaPinningHelper.

This patch fixes the NPE.
  • Loading branch information
ljelinkova authored and ahadas committed Jun 27, 2022
1 parent 3c922b2 commit b4aa257
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -150,8 +150,8 @@ private Runnable fitNodesRunnable(int vmNumaNodeIndex) {
// in NumaValidator
int hugePageSizeMB = hugePageSize.get() / 1024;
int requiredHugePages = (int) vmNode.getMemTotal() / hugePageSizeMB;
int hostFreePages = HugePageUtils.hugePagesToMap(hostNumaNodesData.get(pinnedIndex).getHugePages()).get(hugePageSize.get());
if (hostFreePages < requiredHugePages) {
Integer hostFreePages = HugePageUtils.hugePagesToMap(hostNumaNodesData.get(pinnedIndex).getHugePages()).get(hugePageSize.get());
if (hostFreePages == null || hostFreePages < requiredHugePages) {
return;
}

Expand Down

0 comments on commit b4aa257

Please sign in to comment.