RFR: 8371701: Add ability to set NUMA-affinity for threads
Joel Sikström
jsikstro at openjdk.org
Wed Nov 12 13:38:22 UTC 2025
On Wed, 12 Nov 2025 13:09:43 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> I'm seeing the return value as "was this operation successful or not". I could add a comment in the header file with something like the following if you think it would make things clearer.
>>
>> // Sets the affinity of a thread to the CPUs associated with a NUMA node. Passing node
>> // as -1 sets the affinity to all CPUs the JVM is allowed to run on. Returns true if
>> // the thread's affinity has been changed, false otherwise.
>
> This interpretation makes sense, but what should callers do with the `false` case?
>
> (In #28262, the return-value is just ignored, isn't it?)
Yes we ignore the return value in https://github.com/openjdk/jdk/pull/28262 since the algorithm and functionality works if setting the affinity would fail for some reason. If the return type is false a user could bail or revert to some other strategy. I added the boolean return type as a way for users to have insight into the actual result of the operation, if they care.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28261#discussion_r2518339218
More information about the hotspot-runtime-dev
mailing list