From be18a94f51296cce03d51501858e5f704c5e1950 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 8 Jul 2011 19:25:04 +0200 Subject: [PATCH] Set affinity before doing buffer and io_u allocs Signed-off-by: Jens Axboe --- fio.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/fio.c b/fio.c index 48c728eb..81854818 100644 --- a/fio.c +++ b/fio.c @@ -1092,6 +1092,22 @@ static void *thread_main(void *data) goto err; } + /* + * If we have a gettimeofday() thread, make sure we exclude that + * thread from this job + */ + if (td->o.gtod_cpu) + fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu); + + /* + * Set affinity first, in case it has an impact on the memory + * allocations. + */ + if (td->o.cpumask_set && fio_setaffinity(td->pid, td->o.cpumask) == -1) { + td_verror(td, errno, "cpu_set_affinity"); + goto err; + } + /* * May alter parameters that init_io_u() will use, so we need to * do this first. @@ -1105,23 +1121,6 @@ static void *thread_main(void *data) if (td->o.verify_async && verify_async_init(td)) goto err; - if (td->o.cpumask_set && fio_setaffinity(td->pid, td->o.cpumask) == -1) { - td_verror(td, errno, "cpu_set_affinity"); - goto err; - } - - /* - * If we have a gettimeofday() thread, make sure we exclude that - * thread from this job - */ - if (td->o.gtod_cpu) { - fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu); - if (fio_setaffinity(td->pid, td->o.cpumask) == -1) { - td_verror(td, errno, "cpu_set_affinity"); - goto err; - } - } - if (td->ioprio_set) { if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) { td_verror(td, errno, "ioprio_set"); -- 2.25.1