Open abhishekrai opened 10 years ago
It would be more idiomatic to gContain code to ignore EOPNOTSUPP same as we ignore NOT_FOUND but unfortunately EOPNOTSUPP is swallowed at lower level. I'll take a look how much work is required to pipe that information to higher level. This problem makes me wonder why kernel exposes this file at all if swap accounting is disabled?
Thanks. Yeah, the kernel behavior is puzzling. And unfortunate too, cause only some versions have this problem as I mentioned above, forcing the need for a generic workaround in lmctfy.
I just hit the same issue. gentle bump?
We are seeing that on some kernels, when swap accounting is not enabled, lmctfy is unable to create any containers having memory limit. For example:
At ThoughtSpot, we are seeing this on all 3.8 kernels that we have in our dev environment. However, this works fine on 3.5 and 3.11 kernels which are the other two common kernels we have in our dev environment.
The root cause for this "operation not supported" seems to come from this code from mm/memcontrol.c which is returning EOPNOTSUPP.
Restarting the kernel with swap accounting enabled fixes the problem. In our environment, we always try to place a limit on memory, even if -1 in some cases, and not being able to do that is a limitation. I was curious to see how docker handles this and from the docs it looks like docker also recommends swap accounting to be enabled, but requires it only if user wants swap accounting.
We can work around this issue by enabling swap accounting on all machines, but filing it to see if there is a better approach. I noticed some comments in the code about "feature detection", and in some sense, this is a problem of feature detection where we have an invalid expectation about the kernel features.
One possible fix for this particular issue is to make the following change in MemoryResourceHandler::Update(). Does this look reasonable?