Add a cpuset exit function
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 3944ce7349d89d77d3cc2b28dcd6f94a57dbe7ff..2a468b134de5bb02ed3ee4dece8b8ea9b645b2b8 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -673,7 +673,7 @@ sync_done:
                                int left;
 
                                if (td->o.thinktime_spin)
                                int left;
 
                                if (td->o.thinktime_spin)
-                                       __usec_sleep(td->o.thinktime_spin);
+                                       usec_spin(td->o.thinktime_spin);
 
                                left = td->o.thinktime - td->o.thinktime_spin;
                                if (left)
 
                                left = td->o.thinktime - td->o.thinktime_spin;
                                if (left)
@@ -970,10 +970,6 @@ static void *thread_main(void *data)
         * thread from this job
         */
        if (td->o.gtod_cpu) {
         * thread from this job
         */
        if (td->o.gtod_cpu) {
-               if (fio_getaffinity(td->pid, &td->o.cpumask) == -1) {
-                       td_verror(td, errno, "cpu_get_affinity");
-                       goto err;
-               }
                fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu);
                if (fio_setaffinity(td) == -1) {
                        td_verror(td, errno, "cpu_set_affinity");
                fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu);
                if (fio_setaffinity(td) == -1) {
                        td_verror(td, errno, "cpu_set_affinity");
@@ -1120,6 +1116,9 @@ err:
        close_ioengine(td);
        cleanup_io_u(td);
 
        close_ioengine(td);
        cleanup_io_u(td);
 
+       if (td->o.cpumask_set)
+               fio_cpuset_exit(td);
+
        /*
         * do this very late, it will log file closing as well
         */
        /*
         * do this very late, it will log file closing as well
         */