Skip to content

Conversation

@askervin
Copy link
Contributor

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

@kad
Copy link
Contributor

kad commented Mar 27, 2025

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

@giuseppe
Copy link
Member

LGTM after the changes suggested above

@askervin askervin force-pushed the 5aD-oci-mempolicy branch from be4b9f4 to ee377f1 Compare March 28, 2025 14:56
@askervin
Copy link
Contributor Author

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 askervin force-pushed the 5aD-oci-mempolicy branch from ee377f1 to 68936b6 Compare March 28, 2025 15:00
Copy link
Member

@utam0k utam0k left a comment

Choose a reason for hiding this comment

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

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?

set_mempolicy() sets the NUMA memory policy of the calling thread,
which consists of a policy mode and zero or more nodes, to the
values specified by the mode, nodemask, and maxnode arguments.

The behavior of several other system calls is the same, so it might be a good idea to define their behavior as well.

@utam0k
Copy link
Member

utam0k commented Apr 1, 2025

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.

@giuseppe
Copy link
Member

giuseppe commented Apr 1, 2025

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

@utam0k
Copy link
Member

utam0k commented Apr 1, 2025

@giuseppe Oh, I missed it. Looks good.

@AkihiroSuda AkihiroSuda added this to the v1.3.0 milestone Apr 8, 2025
askervin added a commit to askervin/runc that referenced this pull request Apr 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

TODO:
- remove the replace from go.mod when OCI spec is merged

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Apr 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

TODO:
- remove the replace from go.mod when OCI spec is merged

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Apr 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

TODO:
- remove the replace from go.mod when OCI spec is merged

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Apr 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

TODO:
- remove the replace from go.mod when OCI spec is merged

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Apr 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

TODO:
- remove the replace from go.mod when OCI spec is merged

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Apr 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

TODO:
- remove the replace from go.mod when OCI spec is merged

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Aug 26, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 4, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 4, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 4, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 16, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 17, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 17, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 22, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 25, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 29, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 29, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Sep 29, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
askervin added a commit to askervin/runc that referenced this pull request Oct 7, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
cyphar pushed a commit to cyphar/runc that referenced this pull request Oct 7, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
(cherry picked from commit eda7bdf)
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar pushed a commit to cyphar/runc that referenced this pull request Oct 7, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
(cherry picked from commit eda7bdf)
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar pushed a commit to cyphar/runc that referenced this pull request Oct 8, 2025
Implement support for Linux memory policy in OCI spec PR:
opencontainers/runtime-spec#1282

Signed-off-by: Antti Kervinen <[email protected]>
(cherry picked from commit eda7bdf)
Signed-off-by: Aleksa Sarai <[email protected]>
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.

8 participants