From e600f7f122d344358493f90e9114f9354c63fdfe Mon Sep 17 00:00:00 2001 From: "Gough, Corey D" Date: Wed, 13 Jun 2007 20:58:01 +0200 Subject: [PATCH] Fix cpu mask setting Fio passed the mask by value, not by reference. So when fill_cpu_mask() was done setting the valid CPUs, it was only on the local value. Signed-off-by: Jens Axboe --- options.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/options.c b/options.c index e67742dd..839af0bf 100644 --- a/options.c +++ b/options.c @@ -98,17 +98,16 @@ static int str_exitall_cb(void) return 0; } -static void fill_cpu_mask(os_cpu_mask_t cpumask, int cpu) +static void fill_cpu_mask(os_cpu_mask_t *cpumask, int cpu) { #ifdef FIO_HAVE_CPU_AFFINITY unsigned int i; - CPU_ZERO(&cpumask); + CPU_ZERO(cpumask); - for (i = 0; i < sizeof(int) * 8; i++) { + for (i = 0; i < sizeof(int) * 8; i++) if ((1 << i) & cpu) - CPU_SET(i, &cpumask); - } + CPU_SET(i, cpumask); #endif } @@ -116,7 +115,7 @@ static int str_cpumask_cb(void *data, unsigned int *val) { struct thread_data *td = data; - fill_cpu_mask(td->o.cpumask, *val); + fill_cpu_mask(&td->o.cpumask, *val); td->o.cpumask_set = 1; return 0; } -- 2.25.1