Flexible I/O Tester development
 help / color / mirror / Atom feed
* [FIO][PATCH v1] powerpc: fix cpus_online() to get correct max CPU number for powerpc64
@ 2016-01-25 13:04 Dan Qing Zhang
  2016-01-25 15:30 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Qing Zhang @ 2016-01-25 13:04 UTC (permalink / raw)
  To: axboe; +Cc: fio, zhong, Dan Qing Zhang

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@linux.vnet.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [FIO][PATCH v1] powerpc: fix cpus_online() to get correct max CPU number for powerpc64
  2016-01-25 13:04 [FIO][PATCH v1] powerpc: fix cpus_online() to get correct max CPU number for powerpc64 Dan Qing Zhang
@ 2016-01-25 15:30 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2016-01-25 15:30 UTC (permalink / raw)
  To: Dan Qing Zhang; +Cc: fio, zhong

On 01/25/2016 06:04 AM, Dan Qing Zhang wrote:
> 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).

Thanks, applied. I have a general dislike for discontiguous CPU 
numbering, be it in the kernel or in user space :-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-25 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 13:04 [FIO][PATCH v1] powerpc: fix cpus_online() to get correct max CPU number for powerpc64 Dan Qing Zhang
2016-01-25 15:30 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox