FreeBSD: Add affinity support to tests#1950
Merged
kboyarinov merged 5 commits intouxlfoundation:masterfrom Jan 26, 2026
Merged
Conversation
Fixes test 63: 63 - test_hw_concurrency (Subprocess aborted)
isaevil
reviewed
Jan 26, 2026
Contributor
isaevil
left a comment
There was a problem hiding this comment.
Overall looks good to me, thanks! Small nitpick from my side though
Comment on lines
96
to
102
| #if __linux__ | ||
| cpu_set_t mask; | ||
| sched_getaffinity(0, sizeof(cpu_set_t), &mask); | ||
| #else /* __FreeBSD__ */ | ||
| cpuset_t mask; | ||
| sched_getaffinity(0, sizeof(cpuset_t), &mask); | ||
| #endif |
Contributor
There was a problem hiding this comment.
If name of mask type is the only difference, why not wrap only the type?
Suggested change
| #if __linux__ | |
| cpu_set_t mask; | |
| sched_getaffinity(0, sizeof(cpu_set_t), &mask); | |
| #else /* __FreeBSD__ */ | |
| cpuset_t mask; | |
| sched_getaffinity(0, sizeof(cpuset_t), &mask); | |
| #endif | |
| #if __linux__ | |
| using cpu_mask_t = cpu_set_t; | |
| #else /* __FreeBSD__ */ | |
| using cpu_mask_t = cpuset_t; | |
| #endif | |
| cpu_mask_t mask; | |
| sched_getaffinity(0, sizeof(cpu_mask_t), &mask); |
The same is applicable to changes below.
kboyarinov
reviewed
Jan 26, 2026
Contributor
kboyarinov
left a comment
There was a problem hiding this comment.
Consider moving a dispatch outside the functions to avoid code duplications:
Co-authored-by: Konstantin Boyarinov <konstantin.boyarinov@intel.com>
Co-authored-by: Konstantin Boyarinov <konstantin.boyarinov@intel.com>
Co-authored-by: Konstantin Boyarinov <konstantin.boyarinov@intel.com>
Contributor
Author
|
Should be good now, thanks to both of you! |
kboyarinov
reviewed
Jan 26, 2026
Contributor
kboyarinov
left a comment
There was a problem hiding this comment.
LGTM, except the minor comment
Comment on lines
338
to
339
| cpu_set_type mask; | ||
| sched_getaffinity(0, sizeof(cpu_set_type), &mask); |
Contributor
There was a problem hiding this comment.
Please align the indentation
Contributor
Author
|
Ooops, fixed. Thanks! |
kboyarinov
approved these changes
Jan 26, 2026
Contributor
kboyarinov
left a comment
There was a problem hiding this comment.
LGTM!
Thank you for your contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes test 63:
63 - test_hw_concurrency (Subprocess aborted)
Description
Hi,
Following PR #1945, here is a patch to fix the last failing test (63) by using sched_getaffinity() on FreeBSD.
Best regards,
Ganael Laplanche