Add a cpuset exit function

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index a11f2bb..2a468b1 100644
--- a/fio.c
+++ b/fio.c
@@ -970,10 +970,6 @@
 	 * 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 @@
 	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
 	 */