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

Upstream lwaftr ljsyscall changes #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kbara
Copy link
Contributor

@kbara kbara commented Oct 28, 2016

Hi @justincormack ,

@wingo wrote a couple of patches to ljsyscall, which we've been using in the lwaftr. As per discussion with him, here's a PR upstreaming them. They deal with mempolicy/numa/page migration.

wingo added 2 commits October 28, 2016 17:26
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.
* lib/ljsyscall/syscall/linux/c.lua:
* lib/ljsyscall/syscall/linux/syscalls.lua: Add support for the
  migrate_pages Linux syscall.
@justincormack
Copy link
Owner

Thanks!

I think the CI is failing because of LuaJIT 2.0 vs 2.1 differences. I don't really want to break 2.0 yet, even though most people use 2.1. I think it should be possible to work around the differences, will take a look.

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
Contributor

Choose a reason for hiding this comment

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

Need to use 1 instead of 1ULL so that luajit 2.0 doesn't fail

@justincormack
Copy link
Owner

That won't give the right result though...

On 28 Oct 2016 8:15 p.m., "daurnimator" [email protected] wrote:

@daurnimator commented on this pull request.

In syscall/linux/types.lua
#203 (review)
:

@@ -1016,6 +1016,74 @@ mt.cpu_set = {

addtype(types, "cpu_set", "struct cpu_set_t", mt.cpu_set)

+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)

Need to use 1 instead of 1ULL so that luajit 2.0 doesn't fail


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#203 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAdcPFwJRSGWJWXrV44Cd_h_e2ty9_4yks5q4kkkgaJpZM4KjkR9
.

@kbara
Copy link
Contributor Author

kbara commented Oct 31, 2016

This has significant (but not total) overlap with #193. The numa/mempolicy code is the same, but this one also includes the migrate_pages patch.

@justincormack
Copy link
Owner

@kbara its not just the syntax, 2.0 does not have 64 bit shifts. There are some compatibility functions for 64 bit shifts here https://github.com/justincormack/ljsyscall/blob/master/syscall/bit.lua

@kbara
Copy link
Contributor Author

kbara commented Nov 1, 2016

Yeah - that was a hastily-written patch based on some Jabber discussion, which I should revert. Sorry for the noise.

@kbara kbara force-pushed the upstream-lwaftr-ljsyscall-changes branch from 0b6c6ec to 7122cf4 Compare November 1, 2016 14:56
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.

4 participants