Add a cpuset exit function
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index a11f2bbb76e6989aa1ecf22094fdca2495dd7a1d..2a468b134de5bb02ed3ee4dece8b8ea9b645b2b8 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -970,10 +970,6 @@ static void *thread_main(void *data)
         * 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");
@@ -1120,6 +1116,9 @@ err:
        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
         */