diff mbox series

[3/6] rteval: Exclude isolcpus from kcompile by default

Message ID 20230630091951.916865-4-tglozar@redhat.com
State New
Headers show
Series rteval: Handle isolcpus correctly | expand

Commit Message

Tomas Glozar June 30, 2023, 9:19 a.m. UTC
Allows correct calculation of make job count that does not include
isolated CPUs, on which the loads won't be scheduled.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 rteval/modules/loads/kcompile.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

John Kacur July 25, 2023, 1:40 p.m. UTC | #1
On Fri, 30 Jun 2023, Tomas Glozar wrote:

> Allows correct calculation of make job count that does not include
> isolated CPUs, on which the loads won't be scheduled.
> 
> Signed-off-by: Tomas Glozar <tglozar@redhat.com>
> ---
>  rteval/modules/loads/kcompile.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
> index 35ee5cb..30c5965 100644
> --- a/rteval/modules/loads/kcompile.py
> +++ b/rteval/modules/loads/kcompile.py
> @@ -37,6 +37,7 @@ from rteval.systopology import CpuList, SysTopology
>  
>  expand_cpulist = CpuList.expand_cpulist
>  compress_cpulist = CpuList.compress_cpulist
> +nonisolated_cpulist = CpuList.nonisolated_cpulist
>  
>  DEFAULT_KERNEL_PREFIX = "linux-6.1"
>  
> @@ -55,17 +56,20 @@ class KBuildJob:
>          if not os.path.isdir(self.objdir):
>              os.mkdir(self.objdir)
>  
> +        # Exclude isolated CPUs if cpulist not set
> +        cpus_available = len(nonisolated_cpulist(self.node.cpus.cpulist))
> +
>          if os.path.exists('/usr/bin/numactl') and not cpulist:
>              # Use numactl
>              self.binder = f'numactl --cpunodebind {int(self.node)}'
> -            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
> +            self.jobs = self.calc_jobs_per_cpu() * cpus_available
>          elif cpulist:
>              # Use taskset
>              self.jobs = self.calc_jobs_per_cpu() * len(cpulist)
>              self.binder = f'taskset -c {compress_cpulist(cpulist)}'
>          else:
>              # Without numactl calculate number of jobs from the node
> -            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
> +            self.jobs = self.calc_jobs_per_cpu() * cpus_available
>  
>          self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
>          self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"
> -- 
> 2.41.0
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 35ee5cb..30c5965 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -37,6 +37,7 @@  from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
 compress_cpulist = CpuList.compress_cpulist
+nonisolated_cpulist = CpuList.nonisolated_cpulist
 
 DEFAULT_KERNEL_PREFIX = "linux-6.1"
 
@@ -55,17 +56,20 @@  class KBuildJob:
         if not os.path.isdir(self.objdir):
             os.mkdir(self.objdir)
 
+        # Exclude isolated CPUs if cpulist not set
+        cpus_available = len(nonisolated_cpulist(self.node.cpus.cpulist))
+
         if os.path.exists('/usr/bin/numactl') and not cpulist:
             # Use numactl
             self.binder = f'numactl --cpunodebind {int(self.node)}'
-            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+            self.jobs = self.calc_jobs_per_cpu() * cpus_available
         elif cpulist:
             # Use taskset
             self.jobs = self.calc_jobs_per_cpu() * len(cpulist)
             self.binder = f'taskset -c {compress_cpulist(cpulist)}'
         else:
             # Without numactl calculate number of jobs from the node
-            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+            self.jobs = self.calc_jobs_per_cpu() * cpus_available
 
         self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
         self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"