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

It is not possible set memory.swappiness -1 on old kernel #543

Closed
caiolima opened this issue Feb 9, 2016 · 3 comments · Fixed by #580
Closed

It is not possible set memory.swappiness -1 on old kernel #543

caiolima opened this issue Feb 9, 2016 · 3 comments · Fixed by #580

Comments

@caiolima
Copy link

caiolima commented Feb 9, 2016

I am trying run runc start with the Docker's busybox image but I am getting the following error:

WARN[0000] signal: killed                               
FATA[0000] Container start failed: [10] System error: no such directory for memory.swappiness. 

My config.json is:

{
        "ociVersion": "0.3.0-dev",
        "platform": {
                "os": "linux",
                "arch": "amd64"
        },
        "process": {
                "terminal": true,
                "user": {
                        "uid": 0,
                        "gid": 0
                },
                "args": [
                        "sh"
                ],
                "env": [
                        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                        "TERM=xterm"
                ],
                "cwd": "/"
        },
        "root": {
                "path": "rootfs",
                "readonly": true
        },
        "hostname": "shell",
        "mounts": [
                {
                        "name": "proc",
                        "path": "/proc"
                },
                {
                        "name": "dev",
                        "path": "/dev"
                },
                {
                        "name": "devpts",
                        "path": "/dev/pts"
                },
                {
                        "name": "shm",
                        "path": "/dev/shm"
                },
                {
                        "name": "mqueue",
                        "path": "/dev/mqueue"
                },
                {
                        "name": "sysfs",
                        "path": "/sys"
                },
                {
                        "name": "cgroup",
                        "path": "/sys/fs/cgroup"
                }
        ],
        "linux": {
                "capabilities": [
                        "CAP_AUDIT_WRITE",
                        "CAP_KILL",
                        "CAP_NET_BIND_SERVICE"
                ]
        }
}

and my runtime.js is:

{
        "mounts": {
                "cgroup": {
                        "type": "cgroup",
                        "source": "cgroup",
                        "options": [
                                "nosuid",
                                "noexec",
                                "nodev",
                                "relatime",
                                "ro"
                        ]
                },
                "dev": {
                        "type": "tmpfs",
                        "source": "tmpfs",
                        "options": [
                                "nosuid",
                                "strictatime",
                                "mode=755",
                                "size=65536k"
                        ]
                },
                "devpts": {
                        "type": "devpts",
                        "source": "devpts",
                        "options": [
                                "nosuid",
                                "noexec",
                                "newinstance",
                                "ptmxmode=0666",
                                "mode=0620",
                                "gid=5"
                        ]
                },
                "mqueue": {
                        "type": "mqueue",
                        "source": "mqueue",
                        "options": [
                                "nosuid",
                                "noexec",
                                "nodev"
                        ]
                },
                "proc": {
                        "type": "proc",
                        "source": "proc"
                },
                "shm": {
                        "type": "tmpfs",
                        "source": "shm",
                        "options": [
                                "nosuid",
                                "noexec",
                                "nodev",
                                "mode=1777",
                                "size=65536k"
                        ]
                },
                "sysfs": {
                        "type": "sysfs",
                        "source": "sysfs",
                        "options": [
                                "nosuid",
                                "noexec",
                                "nodev"
                        ]
                }
        },
        "hooks": {},
        "linux": {
                "rlimits": [
                        {
                                "type": "RLIMIT_NOFILE",
                                "hard": 1024,
                                "soft": 1024
                        }
                ],
                "resources": {
                        "memory": {
                                "kernelTCP": null
                        }
                },
                "namespaces": [
                        {
                                "type": "pid"
                        },
                        {
                                "type": "network"
                        },
                        {
                                "type": "ipc"
                        },
                        {
                                "type": "uts"
                        },
                        {
                                "type": "mount"
                        }
                ],
                "devices": [
                        {
                                "path": "/dev/null",
                                "type": 99,
                                "major": 1,
                                "minor": 3,
                                "permissions": "rwm",
                                "fileMode": 438,
                                "uid": 0,
                                "gid": 0
                        },
                        {
                                "path": "/dev/random",
                                "type": 99,
                                "major": 1,
                                "minor": 8,
                                "permissions": "rwm",
                                "fileMode": 438,
                                "uid": 0,
                                "gid": 0
                        },
                        {
                                "path": "/dev/full",
                                "type": 99,
                                "major": 1,
                                "minor": 7,
                                "permissions": "rwm",
                                "fileMode": 438,
                                "uid": 0,
                                "gid": 0
                        },
                        {
                                "path": "/dev/tty",
                                "type": 99,
                                "major": 5,
                                "minor": 0,
                                "permissions": "rwm",
                                "fileMode": 438,
                                "uid": 0,
                                "gid": 0
                        },
                        {
                                "path": "/dev/zero",
                                "type": 99,
                                "major": 1,
                                "minor": 5,
                                "permissions": "rwm",
                                "fileMode": 438,
                                "uid": 0,
                                "gid": 0
                        },
                        {
                                "path": "/dev/urandom",
                                "type": 99,
                                "major": 1,
                                "minor": 9,
                                "permissions": "rwm",
                                "fileMode": 438,
                                "uid": 0,
                                "gid": 0
                        }
                ],
                "apparmorProfile": "",
                "selinuxProcessLabel": "",
                "seccomp": {
                        "defaultAction": "SCMP_ACT_ALLOW",
                        "architectures": null,
                        "syscalls": []
                }
        }
}

Also, my Linux environment is:

Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux

Following the documentation trying to disable the Swappiness, I tried set it to -1 but I got the following error:

json: cannot unmarshal number -1 into Go value of type uint64

Inspecting the opencontainers/specs PRs, I have found this discussion #233 indicating the not int64 usage to solve it. Thus, there is no way to support disable swappiness on old kernels?

Also, since specs changed, there are a lot of "-1" usage to consider Swappiness disabeld like this one.

I think we need to think in a new way to handle this case instead of using the swappiness == -1. What do you think?

@hqhq
Copy link
Contributor

hqhq commented Feb 17, 2016

Can you try the latest runc? For now, if there is no swappiness in your config, it means unlimited, which is the same as the former swappiness=-1 but more reasonable.

And "-1" usage is implementation detail for OCI compliant implementations which should not be considered by users.

@caiolima
Copy link
Author

I have tried it with the latest runc. But the problem is because of this swappiness definition on https://github.com/vishh/specs/blob/488f174af95fd3a38fee3e4dbd33802c13498dd7/runtime_config_linux.go#L164

I have changed it to int64 and it was possible run the container without swappiness. What I think it is a good chang on implementation is to add a new spec/config field called enable_swappiness: true for example.

@crosbymichael
Copy link
Member

This should not be an issue with the 0.0.8 release of runc. The swap files are nullable now.

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 a pull request may close this issue.

3 participants