|
|
ad9577 |
From 72e09b02e7b4cf3e9e77ef02d5073d9a11f3b314 Mon Sep 17 00:00:00 2001
|
|
|
ad9577 |
From: Stanislav Brabec <sbrabec@suse.cz>
|
|
|
ad9577 |
Date: Wed, 9 May 2018 22:13:07 +0200
|
|
|
ad9577 |
Subject: [PATCH 173/173] chcpu: Fix maximal number of CPUs
|
|
|
ad9577 |
|
|
|
ad9577 |
chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit
|
|
|
ad9577 |
mask). It effectively limits number of CPUs to 1/8 of the supported
|
|
|
ad9577 |
amount.
|
|
|
ad9577 |
|
|
|
ad9577 |
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
|
|
|
ad9577 |
Cc: Michael Matz <matz@suse.de>
|
|
|
ad9577 |
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
|
|
|
ad9577 |
Upstream: http://github.com/karelzak/util-linux/commit/607274943bfd3d4856b872bc4278b36903fb2182
|
|
|
ad9577 |
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1579439
|
|
|
ad9577 |
---
|
|
|
ad9577 |
sys-utils/chcpu.c | 16 ++++++++--------
|
|
|
ad9577 |
1 file changed, 8 insertions(+), 8 deletions(-)
|
|
|
ad9577 |
|
|
|
ad9577 |
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
|
|
|
ad9577 |
index 7843dfb22..1a0157360 100644
|
|
|
ad9577 |
--- a/sys-utils/chcpu.c
|
|
|
ad9577 |
+++ b/sys-utils/chcpu.c
|
|
|
ad9577 |
@@ -75,12 +75,12 @@ enum {
|
|
|
ad9577 |
*/
|
|
|
ad9577 |
static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
|
|
|
ad9577 |
{
|
|
|
ad9577 |
- unsigned int cpu;
|
|
|
ad9577 |
+ int cpu;
|
|
|
ad9577 |
int online, rc;
|
|
|
ad9577 |
int configured = -1;
|
|
|
ad9577 |
- size_t fails = 0;
|
|
|
ad9577 |
+ int fails = 0;
|
|
|
ad9577 |
|
|
|
ad9577 |
- for (cpu = 0; cpu < setsize; cpu++) {
|
|
|
ad9577 |
+ for (cpu = 0; cpu < maxcpus; cpu++) {
|
|
|
ad9577 |
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
|
|
|
ad9577 |
continue;
|
|
|
ad9577 |
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
|
|
|
ad9577 |
@@ -132,7 +132,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
|
|
|
ad9577 |
}
|
|
|
ad9577 |
}
|
|
|
ad9577 |
|
|
|
ad9577 |
- return fails == 0 ? 0 : fails == setsize ? -1 : 1;
|
|
|
ad9577 |
+ return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
|
|
|
ad9577 |
}
|
|
|
ad9577 |
|
|
|
ad9577 |
static int cpu_rescan(void)
|
|
|
ad9577 |
@@ -168,11 +168,11 @@ static int cpu_set_dispatch(int mode)
|
|
|
ad9577 |
*/
|
|
|
ad9577 |
static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
|
|
|
ad9577 |
{
|
|
|
ad9577 |
- unsigned int cpu;
|
|
|
ad9577 |
+ int cpu;
|
|
|
ad9577 |
int rc, current;
|
|
|
ad9577 |
- size_t fails = 0;
|
|
|
ad9577 |
+ int fails = 0;
|
|
|
ad9577 |
|
|
|
ad9577 |
- for (cpu = 0; cpu < setsize; cpu++) {
|
|
|
ad9577 |
+ for (cpu = 0; cpu < maxcpus; cpu++) {
|
|
|
ad9577 |
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
|
|
|
ad9577 |
continue;
|
|
|
ad9577 |
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
|
|
|
ad9577 |
@@ -217,7 +217,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
|
|
|
ad9577 |
}
|
|
|
ad9577 |
}
|
|
|
ad9577 |
|
|
|
ad9577 |
- return fails == 0 ? 0 : fails == setsize ? -1 : 1;
|
|
|
ad9577 |
+ return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
|
|
|
ad9577 |
}
|
|
|
ad9577 |
|
|
|
ad9577 |
static void cpu_parse(char *cpu_string, cpu_set_t *cpu_set, size_t setsize)
|
|
|
ad9577 |
--
|
|
|
ad9577 |
2.14.4
|
|
|
ad9577 |
|