[FIO][PATCH v1] powerpc: fix cpus_online() to get correct max CPU number for powerpc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <dqzhang@xxxxxxxxxxxxxxxxxx>
---
 os/os.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/os/os.h b/os/os.h
index fd47f22..02ab40d 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)
 {
-- 
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux