diff mbox series

rteval: kcompile: Use systopology to get a list of cpus on a node

Message ID 20220429202202.23499-1-jkacur@redhat.com
State New
Headers show
Series rteval: kcompile: Use systopology to get a list of cpus on a node | expand

Commit Message

John Kacur April 29, 2022, 8:22 p.m. UTC
kcompile gets a lists of cpus on a node but doesn't take into account
whether the cpus are online or not.

Instead of using the method in kcompile, use the method in systopology,
since that will consider whether the cpus are online or not.

Reported-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Valentin Schneider May 3, 2022, 10:27 a.m. UTC | #1
On 29/04/22 16:22, John Kacur wrote:
> kcompile gets a lists of cpus on a node but doesn't take into account
> whether the cpus are online or not.
>
> Instead of using the method in kcompile, use the method in systopology,
> since that will consider whether the cpus are online or not.
>
> Reported-by: Valentin Schneider <vschneid@redhat.com>
> Signed-off-by: John Kacur <jkacur@redhat.com>

Tested-by: Valentin Schneider <vschneid@redhat.com>

> ---
>  rteval/modules/loads/kcompile.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
> index 367f8dc1ca86..add0cd86cde4 100644
> --- a/rteval/modules/loads/kcompile.py
> +++ b/rteval/modules/loads/kcompile.py
> @@ -202,7 +202,7 @@ class Kcompile(CommandLineLoad):
>          self.cpus = {}
>          self.nodes = self.topology.getnodes()
>          for n in self.nodes:
> -            self.cpus[n] = [int(c.split('/')[-1][3:]) for c in glob.glob('/sys/devices/system/node/node%s/cpu[0-9]*' % n)]
> +            self.cpus[n] = self.topology.getcpus(n)
>              self.cpus[n].sort()
>
>              # if a cpulist was specified, only allow cpus in that list on the node
> --
> 2.35.1
John Kacur May 3, 2022, 1:59 p.m. UTC | #2
On Tue, 3 May 2022, Valentin Schneider wrote:

> On 29/04/22 16:22, John Kacur wrote:
> > kcompile gets a lists of cpus on a node but doesn't take into account
> > whether the cpus are online or not.
> >
> > Instead of using the method in kcompile, use the method in systopology,
> > since that will consider whether the cpus are online or not.
> >
> > Reported-by: Valentin Schneider <vschneid@redhat.com>
> > Signed-off-by: John Kacur <jkacur@redhat.com>
> 
> Tested-by: Valentin Schneider <vschneid@redhat.com>
> 
> > ---
> >  rteval/modules/loads/kcompile.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
> > index 367f8dc1ca86..add0cd86cde4 100644
> > --- a/rteval/modules/loads/kcompile.py
> > +++ b/rteval/modules/loads/kcompile.py
> > @@ -202,7 +202,7 @@ class Kcompile(CommandLineLoad):
> >          self.cpus = {}
> >          self.nodes = self.topology.getnodes()
> >          for n in self.nodes:
> > -            self.cpus[n] = [int(c.split('/')[-1][3:]) for c in glob.glob('/sys/devices/system/node/node%s/cpu[0-9]*' % n)]
> > +            self.cpus[n] = self.topology.getcpus(n)
> >              self.cpus[n].sort()
> >
> >              # if a cpulist was specified, only allow cpus in that list on the node
> > --
> > 2.35.1
> 
> 

I added your Tested-by: to the commit.

Thanks for testing!

John
diff mbox series

Patch

diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 367f8dc1ca86..add0cd86cde4 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -202,7 +202,7 @@  class Kcompile(CommandLineLoad):
         self.cpus = {}
         self.nodes = self.topology.getnodes()
         for n in self.nodes:
-            self.cpus[n] = [int(c.split('/')[-1][3:]) for c in glob.glob('/sys/devices/system/node/node%s/cpu[0-9]*' % n)]
+            self.cpus[n] = self.topology.getcpus(n)
             self.cpus[n].sort()
 
             # if a cpulist was specified, only allow cpus in that list on the node