Am 21.05.2021 um 22:19 schrieb John Kacur:
How about set_thread_affinity() since you want to use the function
for the main thread plus other threads.
+static void set_main_thread_affinity(struct bitmask *cpumask)
+{
+ int res;
+
+ errno = 0;
+ res = numa_sched_setaffinity(getpid(), cpumask);
+ if (res != 0)
+ warn("Couldn't setaffinity in main thread: %s\n",
+ strerror(errno));
+}
+
Actually, I only intended to use this for the main thread.
I didn't touch the affinity setting of the timerthreads (and don't see a
need to).
I'm not familiar with the whole cyclictest code and all options. Did you
have
any specific threads in mind that also use numa_sched_setaffinity() and
could
use this function?
Maybe you got that impression from the previous v3 iteration, where I
moved the functionality
to rt_numa and added a parameter for the pid/tid. My motivation there
was mainly,
that if I'm moving it into a library, then I should probably add a
parameter for the pid to the function
in case someone has a usecase for that.