Skip to content

Add get_mempolicy, set_mempolicy NUMA syscalls#193

Open
wingo wants to merge 1 commit into
justincormack:masterfrom
wingo:numa
Open

Add get_mempolicy, set_mempolicy NUMA syscalls#193
wingo wants to merge 1 commit into
justincormack:masterfrom
wingo:numa

Conversation

@wingo

@wingo wingo commented May 25, 2016

Copy link
Copy Markdown
Contributor

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.
Comment thread syscall/linux/types.lua
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

wingo commented May 26, 2016

Copy link
Copy Markdown
Contributor Author

Tx for the feedback, will poke.

@justincormack

Copy link
Copy Markdown
Owner

Would be nice to fix the CI issues...

@wingo

wingo commented Aug 3, 2016

Copy link
Copy Markdown
Contributor Author

tx for the ping, will poke

@wingo

wingo commented Aug 4, 2017

Copy link
Copy Markdown
Contributor Author

Related: snabbco/snabb#1200

I should get back on this upstreaming horse!

@justincormack

Copy link
Copy Markdown
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