I'm running CentOS 7 with kernel 3.10.0-693.5.2.el7.x86_64
.
I use cgroups to apply a memory limit on processes. During rolling restart of the application the memory limit is doubled to accommodate the memory needs.
However sometimes after the restart it's not possible to lower the swap memory limit to the original value and cgroup returns an error write error: Device or resource busy
Such as
[root@us app]# echo "643825664" > memory.limit_in_bytes
[root@us app]# echo "673825664" > memory.memsw.limit_in_bytes
-bash: echo: write error: Device or resource busy
[root@us app]# echo "873825664" > memory.memsw.limit_in_bytes
[root@us app]#
Writing a bigger value (such as +200MB) seems to work ok.
I haven't figured out why this happens. I didn't find anything in the cgroup documentation which would refer to this error. I assume it has to do something with the current swap usage being higher than the limit.
Do you have any experience with such errors?