Make lockmem a per job option
[fio.git] / backend.c
index fcb74dcbcfc3d39b7916c3c1f2f8fcb43127e889..5fc0fc86f7ae7ab94abd7317cba44c194850c0d1 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1205,6 +1205,9 @@ static void *thread_main(void *data)
        }
 #endif
 
+       if (fio_pin_memory(td))
+               goto err;
+
        /*
         * May alter parameters that init_io_u() will use, so we need to
         * do this first.
@@ -1256,6 +1259,8 @@ static void *thread_main(void *data)
                        goto err;
        }
 
+       fio_verify_init(td);
+
        fio_gettime(&td->epoch, NULL);
        fio_getrusage(&td->ru_start);
        clear_state = 0;
@@ -1328,6 +1333,8 @@ static void *thread_main(void *data)
        td->ts.io_bytes[DDIR_WRITE] = td->io_bytes[DDIR_WRITE];
        td->ts.io_bytes[DDIR_TRIM] = td->io_bytes[DDIR_TRIM];
 
+       fio_unpin_memory(td);
+
        fio_mutex_down(writeout_mutex);
        if (td->bw_log) {
                if (td->o.bw_log_file) {
@@ -1543,9 +1550,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;
        
@@ -1778,7 +1782,6 @@ static void run_threads(void)
        fio_idle_prof_stop();
 
        update_io_ticks();
-       fio_unpin_memory();
 }
 
 void wait_for_disk_thread_exit(void)