cpus_allowed_policy fixups
- Make 'split' roundrobin the CPUs, if we have more threads
than CPUs in the set.
- Properly use a CPU index, don't assume a sequential set of
CPUs.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 7a0a3f0..c8896b8 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -103,6 +103,31 @@
#define fio_cpu_clear(mask, cpu) pset_assign(PS_NONE, (cpu), NULL)
#define fio_cpu_set(mask, cpu) pset_assign(*(mask), (cpu), NULL)
+static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
+{
+ const unsigned int max_cpus = cpus_online();
+ processorid_t *cpus;
+ int i, ret;
+
+ cpus = malloc(sizeof(*cpus) * max_cpus);
+
+ if (pset_info(*mask, NULL, &num_cpus, cpus) < 0) {
+ free(cpus);
+ return 0;
+ }
+
+ ret = 0;
+ for (i = 0; i < max_cpus; i++) {
+ if (cpus[i] == cpu) {
+ ret = 1;
+ break;
+ }
+ }
+
+ free(cpus);
+ return ret;
+}
+
static inline int fio_cpuset_init(os_cpu_mask_t *mask)
{
if (pset_create(mask) < 0)