Recent changes (master)

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

 



The following changes since commit a1fc70fbb0497a4e0dc061bd8fc35c8d4d29d2dd:

  windows: fix fio_cpu_count() definition (2014-02-27 16:24:15 -0800)

are available in the git repository at:

  git://git.kernel.dk/fio.git master

for you to fetch changes up to ada083cdf71779d7969318e12e91ad18f5864485:

  Update cpus_allowed_policy=split documentation (2014-02-28 16:43:57 -0800)

----------------------------------------------------------------
Jens Axboe (3):
      Fix off-by-one bug in CPU split mask handling
      cpus_allowed_policy fixups
      Update cpus_allowed_policy=split documentation

Peter Oberparleiter (1):
      fio: fix last block never being touched by random offsets

 HOWTO           |    5 +++--
 backend.c       |    2 +-
 fio.1           |    5 +++--
 io_u.c          |    2 +-
 options.c       |   17 ++++++++++++-----
 os/os-freebsd.h |    1 +
 os/os-linux.h   |    1 +
 os/os-solaris.h |   25 +++++++++++++++++++++++++
 os/os-windows.h |    5 +++++
 9 files changed, 52 insertions(+), 11 deletions(-)

---

Diff of recent changes:

diff --git a/HOWTO b/HOWTO
index ef2b631..9a9f02a 100644
--- a/HOWTO
+++ b/HOWTO
@@ -936,8 +936,9 @@ cpus_allowed_policy=str Set the policy of how fio distributes the CPUs
 		split	Each job will get a unique CPU from the CPU set.
 
 		'shared' is the default behaviour, if the option isn't
-		specified. If split is specified, then fio will error out if
-		there are more jobs defined than CPUs given in the set.
+		specified. If split is specified, then fio will will assign
+		one cpu per job. If not enough CPUs are given for the jobs
+		listed, then fio will roundrobin the CPUs in the set.
 
 numa_cpu_nodes=str Set this job running on spcified NUMA nodes' CPUs. The
 		arguments allow comma delimited list of cpu numbers,
diff --git a/backend.c b/backend.c
index 12c76d8..72d9d6d 100644
--- a/backend.c
+++ b/backend.c
@@ -1279,7 +1279,7 @@ static void *thread_main(void *data)
 	 */
 	if (o->cpumask_set) {
 		if (o->cpus_allowed_policy == FIO_CPUS_SPLIT) {
-			ret = fio_cpus_split(&o->cpumask, td->thread_number);
+			ret = fio_cpus_split(&o->cpumask, td->thread_number - 1);
 			if (!ret) {
 				log_err("fio: no CPUs set\n");
 				log_err("fio: Try increasing number of available CPUs\n");
diff --git a/fio.1 b/fio.1
index 863b0e0..764e323 100644
--- a/fio.1
+++ b/fio.1
@@ -847,8 +847,9 @@ Each job will get a unique CPU from the CPU set.
 .RE
 .P
 \fBshared\fR is the default behaviour, if the option isn't specified. If
-\fBsplit\fR is specified, then fio will error out if there are more jobs
-defined than CPUs given in the set.
+\fBsplit\fR is specified, then fio will assign one cpu per job. If not enough
+CPUs are given for the jobs listed, then fio will roundrobin the CPUs in
+the set.
 .RE
 .P
 .TP
diff --git a/io_u.c b/io_u.c
index 77557df..75b23eb 100644
--- a/io_u.c
+++ b/io_u.c
@@ -104,7 +104,7 @@ static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f,
 
 		dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r);
 
-		*b = (lastb - 1) * (r / ((uint64_t) rmax + 1.0));
+		*b = lastb * (r / ((uint64_t) rmax + 1.0));
 	} else {
 		uint64_t off = 0;
 
diff --git a/options.c b/options.c
index c1a8f32..4ff4c9b 100644
--- a/options.c
+++ b/options.c
@@ -394,16 +394,23 @@ static int str_exitall_cb(void)
 }
 
 #ifdef FIO_HAVE_CPU_AFFINITY
-int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu)
+int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
 {
+	unsigned int i, index, cpus_in_mask;
 	const long max_cpu = cpus_online();
-	unsigned int i;
 
+	cpus_in_mask = fio_cpu_count(mask);
+	cpu_index = cpu_index % cpus_in_mask;
+
+	index = 0;
 	for (i = 0; i < max_cpu; i++) {
-		if (cpu != i) {
-			fio_cpu_clear(mask, i);
+		if (!fio_cpu_isset(mask, i))
 			continue;
-		}
+
+		if (cpu_index != index)
+			fio_cpu_clear(mask, i);
+
+		index++;
 	}
 
 	return fio_cpu_count(mask);
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index 402792a..e35c835 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -32,6 +32,7 @@ typedef cpuset_t os_cpu_mask_t;
 
 #define fio_cpu_clear(mask, cpu)        (void) CPU_CLR((cpu), (mask))
 #define fio_cpu_set(mask, cpu)          (void) CPU_SET((cpu), (mask))
+#define fio_cpu_isset(mask, cpu)	CPU_ISSET((cpu), (mask))
 #define fio_cpu_count(maks)		CPU_COUNT((mask))
 
 static inline int fio_cpuset_init(os_cpu_mask_t *mask)
diff --git a/os/os-linux.h b/os/os-linux.h
index 3ed8c2e..ef80ce2 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -61,6 +61,7 @@ typedef struct drand48_data os_random_state_t;
 
 #define fio_cpu_clear(mask, cpu)	(void) CPU_CLR((cpu), (mask))
 #define fio_cpu_set(mask, cpu)		(void) CPU_SET((cpu), (mask))
+#define fio_cpu_isset(mask, cpu)	CPU_ISSET((cpu), (mask))
 #define fio_cpu_count(maks)		CPU_COUNT((mask))
 
 static inline int fio_cpuset_init(os_cpu_mask_t *mask)
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 @@ static inline int fio_set_odirect(int fd)
 #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)
diff --git a/os/os-windows.h b/os/os-windows.h
index 243edc6..49f9606 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -215,6 +215,11 @@ static inline void fio_cpu_set(os_cpu_mask_t *mask, int cpu)
 	*mask |= 1 << cpu;
 }
 
+static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu)
+{
+	return (*mask & (1U << cpu));
+}
+
 static inline int fio_cpu_count(os_cpu_mask_t *mask)
 {
 	return hweight64(*mask);
--
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