Make lockmem a per job option
[fio.git] / backend.c
index 4c784e866a9cbbd91810660b11c3da82a38bda63..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.
@@ -1144,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) {
@@ -1354,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;
 
@@ -1579,7 +1581,6 @@ static void run_threads(void)
        }
 
        update_io_ticks();
-       fio_unpin_memory();
 }
 
 static void *disk_thread_main(void *data)