From 874d55e50cac071bf64fceb7e739b9b8bf8d4deb Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 30 Mar 2021 17:38:33 -0600 Subject: [PATCH] os/os-linux: add pthread CPU affinity helper Signed-off-by: Jens Axboe --- os/os-linux.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/os/os-linux.h b/os/os-linux.h index 5562b0da..ea8d7922 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -74,6 +74,9 @@ typedef cpu_set_t os_cpu_mask_t; sched_getaffinity((pid), (ptr)) #endif +#define fio_get_thread_affinity(mask) \ + pthread_getaffinity_np(pthread_self(), sizeof(mask), &(mask)) + #define fio_cpu_clear(mask, cpu) (void) CPU_CLR((cpu), (mask)) #define fio_cpu_set(mask, cpu) (void) CPU_SET((cpu), (mask)) #define fio_cpu_isset(mask, cpu) (CPU_ISSET((cpu), (mask)) != 0) -- 2.25.1