runtime-spec icon indicating copy to clipboard operation
runtime-spec copied to clipboard

Add support for Linux memory policy

Open askervin opened this issue 9 months ago • 6 comments

Enable setting a NUMA memory policy for the container. New linux.mempolicy object contains inputs to the set_mempolicy(2) syscall.

askervin avatar Mar 27 '25 13:03 askervin

Small nit, I'd suggest to use MemoryPolicy and memoryPolicy instead of mempolicy. It would be more readable IMHO.

kad avatar Mar 27 '25 15:03 kad

LGTM after the changes suggested above

giuseppe avatar Mar 28 '25 12:03 giuseppe

Small nit, I'd suggest to use MemoryPolicy and memoryPolicy instead of mempolicy. It would be more readable IMHO.

Thanks @kad, fixed. Definitely better.

askervin avatar Mar 28 '25 14:03 askervin

It seems set_mempolicy(2) is only effective agains for called threads.

I'm not sure but we may need to implement it in nsexec.c of runc because of the thread limitation. I recommend to implement PoC in runc.

utam0k avatar Apr 01 '25 09:04 utam0k

It seems set_mempolicy(2) is only effective agains for called threads. I'm not sure how to do it for processes created with exec. Any ideas?

the man page says:

The process memory policy is preserved across an [execve](https://linux.die.net/man/2/execve)(2), and is inherited by child processes created using [fork](https://linux.die.net/man/2/fork)(2) or [clone](https://linux.die.net/man/2/clone)(2).

so I don't think it is a problem for the spec

giuseppe avatar Apr 01 '25 09:04 giuseppe

@giuseppe Oh, I missed it. Looks good.

utam0k avatar Apr 01 '25 09:04 utam0k