Skip to content

Commit

Permalink
core: don't use vdsm core for isolate threads
Browse files Browse the repository at this point in the history
When allocating CPUs for isolate threads we use the maximum freed
socket. We get all the non-pinned CPUs for this socket. The problem is
that later on we don't filter out cores with pinned CPUs. Now we return
all the CPUs in the socket and that way, when we iterate the cores, we
are able to filter out those with pinned CPUs.

Change-Id: Ic81d93ecd830cea689a8eea4579d6e728c5b2e04
Bug-Url: https://bugzilla.redhat.com/2094415
Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
  • Loading branch information
liranr23 authored and ahadas committed Jun 14, 2022
1 parent 3a099e0 commit e070095
Showing 1 changed file with 10 additions and 13 deletions.
Expand Up @@ -147,7 +147,7 @@ private List<VdsCpuUnit> allocateDedicatedCpus(List<VdsCpuUnit> cpuTopology, VM
int onlineSockets = getOnlineSockets(cpuTopology).size();
int numOfAllocatedCPUs = 0;
while (onlineSockets > 0 && socketsLeft > 0) {
List<VdsCpuUnit> cpusInChosenSocket = getMaxFreedSocket(cpuTopology);
List<VdsCpuUnit> cpusInChosenSocket = getCoresInSocket(cpuTopology, getMaxFreedSocket(cpuTopology));
if (cpusInChosenSocket.isEmpty()) {
break;
}
Expand Down Expand Up @@ -269,11 +269,6 @@ public int countUnavailableCpus(List<VdsCpuUnit> cpuTopology, boolean countThrea
}
}

public int getDedicatedCount(Guid vdsId) {
return (int) resourceManager.getVdsManager(vdsId).getCpuTopology().stream()
.filter(VdsCpuUnit::isExclusive).count();
}

private List<Integer> getOnlineSockets(List<VdsCpuUnit> cpuTopology) {
return cpuTopology.stream().map(VdsCpuUnit::getSocket).distinct().collect(Collectors.toList());
}
Expand All @@ -286,16 +281,18 @@ private List<Integer> getOnlineCores(List<VdsCpuUnit> cpuTopology) {
return cpuTopology.stream().map(VdsCpuUnit::getCore).distinct().collect(Collectors.toList());
}

private List<VdsCpuUnit> getMaxFreedSocket(List<VdsCpuUnit> cpuTopology) {
private int getMaxFreedSocket(List<VdsCpuUnit> cpuTopology) {
List<VdsCpuUnit> chosenSocket = Collections.emptyList();
List<VdsCpuUnit> temp;
for (int socket : getOnlineSockets(cpuTopology)) {
temp = getFreeCpusInSocket(cpuTopology, socket);
if (temp.size() > chosenSocket.size()) {
chosenSocket = temp;
List<Integer> onlineSocketIds = getOnlineSockets(cpuTopology);
int chosenSocketId = onlineSocketIds.get(0);
for (int socket : onlineSocketIds) {
List<VdsCpuUnit> freeCpusInSocket = getFreeCpusInSocket(cpuTopology, socket);
if (freeCpusInSocket.size() > chosenSocket.size()) {
chosenSocket = freeCpusInSocket;
chosenSocketId = socket;
}
}
return chosenSocket;
return chosenSocketId;
}

/**
Expand Down

0 comments on commit e070095

Please sign in to comment.