Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_mempolicy, set_mempolicy NUMA syscalls #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wingo
Copy link
Contributor

@wingo wingo commented May 25, 2016

Calling get_mempolicy() will return an object with "mode" and "mask"
keys, corresponding to the two output arguments of the get_mempolicy
function. The mask is implemented along the lines of cpu_set, except
that it can hold any number of bits, defaulting to the size of a long.

set_mempolicy(mode, mask) imposes a mode and possibly a mask as well.

I have tested this in Snabb and interactively but I would appreciate suggestions on what automated tests would be required.

Calling get_mempolicy() will return an object with "mode" and "mask"
keys, corresponding to the two output arguments of the get_mempolicy
function.  The mask is implemented along the lines of cpu_set, except
that it can hold any number of bits, defaulting to the size of a long.

set_mempolicy(mode, mask) imposes a mode and possibly a mask as well.
local ulong_bit_count = ffi.sizeof('unsigned long') * 8
local function ulong_index_and_bit(n)
local i = math.floor(n / ulong_bit_count)
local b = bit.lshift(1ULL, n - i * ulong_bit_count)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI is objecting to the 1ULL in bit.lshift

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that may be luajit 2.1 vs 2.0 issue, about 64 bit bitops. Would be nice to work around...

@justincormack
Copy link
Owner

There are a few CI issues.

For automated tests you should be able to at least call get_mempolicy and check it returns something, setting might not be worth testing, although maybe you could set the same policy as returned by get to make sure it round trips?

@wingo
Copy link
Contributor Author

wingo commented May 26, 2016

Tx for the feedback, will poke.

@justincormack
Copy link
Owner

Would be nice to fix the CI issues...

@wingo
Copy link
Contributor Author

wingo commented Aug 3, 2016

tx for the ping, will poke

@wingo
Copy link
Contributor Author

wingo commented Aug 4, 2017

Related: snabbco/snabb#1200

I should get back on this upstreaming horse!

@justincormack
Copy link
Owner

Yes I think https://github.com/snabbco/snabb/pull/1268/files is needed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants