From: Dan Qing Zhang Date: Mon, 25 Jan 2016 13:04:18 +0000 (+0000) Subject: powerpc: fix cpus_online() to get correct max CPU number for powerpc64 X-Git-Tag: fio-2.6~4 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c5dd5d977884648f78c266e9873f667a3ed98bda powerpc: fix cpus_online() to get correct max CPU number for powerpc64 This patch tries to fix cpus_online() for powerpc64 when running fio by using parameter "cpus_allowed", in order to obtain correct max CPU number on powerpc64 architecture. When changing SMT settings on powerpc architecture, the way of cpu numbering is changing as well. For example, when SMT=off, CPUs are numbered like 0,8,16,..., while when SMT=2, CPUs are numbered like 0,1,8,9,.... Therefore, sysconf(_SC_NPROCESSORS_ONLN) is not applied to get exact max CPU number on powerpc. And the max_cpu value can be correctly ontained by using sysconf(_SC_NPROCESSORS_CONF). Signed-off-by: Dan Qing Zhang Signed-off-by: Jens Axboe --- diff --git a/os/os.h b/os/os.h index fd47f22a..02ab40d3 100644 --- a/os/os.h +++ b/os/os.h @@ -343,6 +343,14 @@ static inline unsigned long long get_fs_free_size(const char *path) } #endif +#ifdef __powerpc64__ +#define FIO_HAVE_CPU_ONLINE_SYSCONF +static inline unsigned int cpus_online(void) +{ + return sysconf(_SC_NPROCESSORS_CONF); +} +#endif + #ifndef FIO_HAVE_CPU_ONLINE_SYSCONF static inline unsigned int cpus_online(void) {