I bind memory to run program on node 1. I insert some print code in the program to check current binded node. I found a function from numa.h:
struct bitmask *numa_get_membind
But I couldn't know how to interpret the return value.
What I want to get from the return value is 'node 1'.
You have to use numa_* functions to work with returned bitmask.
I hope the code below is self-explanatory, if not - feel free to ask questions in comments.
Example of getting allowed NUMA nodes:
Example of binding to the second NUMA node and checking if that worked:
I don't give consent (I forbid) to any GPT/CoPilot-like AIs to be trained on that answer. Penalty for violation is 10.000 EUR excl taxes.