You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.4 KiB

From 56cec3cf78392f2464f28129b1de70c53616de26 Mon Sep 17 00:00:00 2001
From: Jozef Bacik <jobacik@redhat.com>
Date: Wed, 24 Aug 2016 11:05:05 +0100
Subject: [PATCH] fix parse_affinity for CPU numbers greater than 31
The function parse_affinity reports wrong results for CPU numbers
greater than 31.
The problem is caused by the function bitmastlist which parse_affinity
calls. The fix treats the inpput line as a long hexbitmask instead of an
array in order to produce correct results
Signed-off-by: Jozef Bacik <jobacik@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
procfs/utilist.py | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/procfs/utilist.py b/procfs/utilist.py
index 18645c0ba45e..0e7c24f45cda 100755
--- a/procfs/utilist.py
+++ b/procfs/utilist.py
@@ -37,18 +37,14 @@ def hexbitmask(l, nr_entries):
return hexbitmask
def bitmasklist(line, nr_entries):
- fields = line.strip().split(",")
+ hexmask = line.strip().replace(",", "")
bitmasklist = []
entry = 0
- for i in range(len(fields) - 1, -1, -1):
- mask = int(fields[i], 16)
- while mask != 0:
- if mask & 1:
- bitmasklist.append(entry)
- mask >>= 1
- entry += 1
- if entry == nr_entries:
- break
+ bitmask = bin(int(hexmask, 16))[2::]
+ for i in reversed(bitmask):
+ if int(i) & 1:
+ bitmasklist.append(entry)
+ entry +=1
if entry == nr_entries:
break
return bitmasklist
--
2.4.11