From: Gough, Corey D Date: Wed, 13 Jun 2007 18:58:01 +0000 (+0200) Subject: Fix cpu mask setting X-Git-Tag: fio-1.16.4~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=e600f7f122d344358493f90e9114f9354c63fdfe;p=fio.git 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 --- 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; }