Fix a few fallouts
v3 cover Fix a few fallouts
v1:
- initial version
v2:
- update error message for sched_getaffinity()
v3:
- updated commit message for sched_getaffinity()
Daniel Wagner (1):
rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
src/lib/rt-numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.32.0
PATCH v3 1/1 rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
pthread_getaffinity_np() prevents static builds as glibc does not expose it for this configuration. Instead use sched_getaffinity() directly as pthread_getaffinity_np() is just a fancy glibc wrapper around sched_getaffinity().
Static builds helps in in situation where the rootfs is minimal and does for example not ship libnuma.
The pthread_getaffinity_np call was introduced by commit f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified [NUM]")
--- src/lib/rt-numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
src/lib/rt-numa.c +2 -4
@@ -68,15 +68,13 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)int cpu_for_thread_ua (int thread_num,int max_cpus) {int res, num_cpus, i, m, cpu; -pthread_t thread;cpu_set_t cpuset; - thread =pthread_self ();CPU_ZERO (&cpuset); - res =pthread_getaffinity_np (thread,sizeof (cpu_set_t), &cpuset); + res =sched_getaffinity (0 ,sizeof (cpu_set_t), &cpuset);if (res !=0 ) -fatal ("pthread_getaffinity_np failed: %s\n" ,strerror (res)); +fatal ("sched_getaffinity failed: %s\n" ,strerror (res)); num_cpus =CPU_COUNT (&cpuset); m = thread_num % num_cpus;
Signature · 1 line
2.32.0
Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
Quoted 11 lines · Daniel Wagner
pthread_getaffinity_np()prevents static builds as glibc does not expose it for this configuration. Instead usesched_getaffinity()directly aspthread_getaffinity_np()is just a fancy glibc wrapper aroundsched_getaffinity().Static builds helps in in situation where the rootfs is minimal and does for example not ship libnuma.
The
pthread_getaffinity_npcall was introduced by commitf240656b056b("rt-tests: cyclictest: Fix -t without a user specified [NUM]")
ping
Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
In reply to Daniel WagnerQuoted 43 lines · Daniel Wagner
pthread_getaffinity_np()prevents static builds as glibc does not expose it for this configuration. Instead usesched_getaffinity()directly aspthread_getaffinity_np()is just a fancy glibc wrapper aroundsched_getaffinity().Static builds helps in in situation where the rootfs is minimal and does for example not ship libnuma.
The
pthread_getaffinity_npcall was introduced by commitf240656b056b("rt-tests: cyclictest: Fix -t without a user specified [NUM]")Signed-off-by Daniel Wagner <[email protected]>--- src/lib/rt-numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)src/lib/rt-numa.c +2
-4@@ -68,15 +68,13 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)int cpu_for_thread_ua (int thread_num,int max_cpus) {int res, num_cpus, i, m, cpu; -pthread_t thread;cpu_set_t cpuset; - thread =pthread_self ();CPU_ZERO (&cpuset); - res =pthread_getaffinity_np (thread,sizeof (cpu_set_t), &cpuset); + res =sched_getaffinity (0 ,sizeof (cpu_set_t), &cpuset);if (res !=0 ) -fatal ("pthread_getaffinity_np failed: %s\n" ,strerror (res)); +fatal ("sched_getaffinity failed: %s\n" ,strerror (res)); num_cpus =CPU_COUNT (&cpuset); m = thread_num % num_cpus;Signature · 1 line
2.32.0
-Some minor fixes to the description
Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
Hi John,
Quoted 1 line · John Kacur
-Some minor fixes to the description
Thanks a lot. Do you plan to do a release soon? I'd like to update the versions in LAVA's test-definition test suite. And it's way simpler to base it on a released version.
Thanks,
Daniel
Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
Quoted 12 lines · Daniel Wagner
Hi John,
Quoted 1 line · John Kacur
-Some minor fixes to the description
Thanks a lot. Do you plan to do a release soon? I'd like to update the versions in LAVA's test-definition test suite. And it's way simpler to base it on a released version.
Thanks,
Daniel
I hadn't planned on doing so, but I can do so if it will help you out. I can probably get to this, this afternoon my time, or if not, then tomorrow.
Could you provide a link to LAVA again so I don't have to go looking for it.?
Thanks
John
Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
Hi John,
Quoted 3 lines · John Kacur
I hadn't planned on doing so, but I can do so if it will help you out. I can probably get to this, this afternoon my time, or if not, then tomorrow.
Great. Thanks!
Quoted 2 lines
Could you provide a link to LAVA again so I don't have to go looking for it.?
https://github.com/Linaro/test-definitions
and the main script for cyclictest is here:
https://github.com/Linaro/test-definitions/tree/master/automated/linux/cyclictest
There is the 'bin' folder which contains a static build binary. I know, this is a bit strange. I'll try to argue with upstream and see if we get this dropped eventually. But for this update I'd like to get the JSON output feature enabled first and not get lost in the discussion why the static build binary should be dropped.
BTW, I've queued the JSON changes in my tree:
https://github.com/igaw/test-definitions/tree/rt-tests-json
I think I could get this ready before Plumbers, so that we can discuss the next steps during a MC/BoF.
Thanks,
Daniel