Make lockmem a per job option
[fio.git] / backend.c
index 319bd253342e164405d04cc5d1506a1e6f29337e..ad9231330547dc39278dd40d1ed94c37d0e2455e 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1029,6 +1029,9 @@ static void *thread_main(void *data)
                goto err;
        }
 
+       if (fio_pin_memory(td))
+               goto err;
+
        /*
         * May alter parameters that init_io_u() will use, so we need to
         * do this first.
@@ -1080,6 +1083,8 @@ static void *thread_main(void *data)
                        goto err;
        }
 
+       fio_verify_init(td);
+
        fio_gettime(&td->epoch, NULL);
        getrusage(RUSAGE_SELF, &td->ru_start);
 
@@ -1142,6 +1147,8 @@ static void *thread_main(void *data)
        td->ts.io_bytes[0] = td->io_bytes[0];
        td->ts.io_bytes[1] = td->io_bytes[1];
 
+       fio_unpin_memory(td);
+
        fio_mutex_down(writeout_mutex);
        if (td->bw_log) {
                if (td->o.bw_log_file) {
@@ -1352,9 +1359,6 @@ static void run_threads(void)
        unsigned long spent;
        unsigned int i, todo, nr_running, m_rate, t_rate, nr_started;
 
-       if (fio_pin_memory())
-               return;
-
        if (fio_gtod_offload && fio_start_gtod_thread())
                return;
 
@@ -1577,7 +1581,6 @@ static void run_threads(void)
        }
 
        update_io_ticks();
-       fio_unpin_memory();
 }
 
 static void *disk_thread_main(void *data)