Skip to content

Do not translate MemoryLimit and MemoryMax to each other#4096

Closed
walyong wants to merge 2 commits intosystemd:masterfrom
walyong:do_not_translate_memory_limit
Closed

Do not translate MemoryLimit and MemoryMax to each other#4096
walyong wants to merge 2 commits intosystemd:masterfrom
walyong:do_not_translate_memory_limit

Conversation

@walyong
Copy link
Contributor

@walyong walyong commented Sep 5, 2016

As already introduced in man page, do not set MemoryLimit config to MemoryMax or MemoryMax to MemoryLimit.

This setting is supported only if the unified control group hierarchy is used. Use MemoryLimit= on systems using the legacy control group hierarchy.

@evverx
Copy link
Contributor

evverx commented Sep 7, 2016

da4d897

  • Implement compatibility translation between MemoryMax and MemoryLimit.

Why should we remove this?

@walyong
Copy link
Contributor Author

walyong commented Sep 7, 2016

According to man page, MemoryMax= seems only valid in unified control group hierarchy and MemoryLimit= seems only valid in legacy control group. So I think this translation is weird.
If we want to keep this translation the man pages have to be modified.

But, recently, MemorySwapMax= is added. #3659
MemorySwapMax= does not translate to memory.memsw.limit_in_bytes of legecy control group. @htejun commented for this like:

This translation doesn't make sense to me. memsw of cgroup v1 and swap of cgroup v2 have very different semantics and I don't think it'd be a good idea to translate the two back and forth this way. Given that systemd omits other aspects of memcg on cgroup v1 and that memsw is difficult to wrap one's head around, I'd recommend just implementing swap max for cgroup v2.

So I think, better than modifying the translation between MemoryLimit= and MemoryMax=, removing this translation is prefer.

@evverx
Copy link
Contributor

evverx commented Sep 7, 2016

@walyong , thanks for the link!

Hm, we have already released da4d897

I think we shouldn't translate MemoryMax to MemoryLimit if MemorySwapMax is set. This is ugly but doesn't introduce a regression.

@poettering
Copy link
Member

@walyong can you comment on #4269? It turns off the translation one-way. That should be close enough to what you want, no?

I'll close this PR now in favour of #4269, let's follow-up the discussions regarding what to translate and what not to translate there.

I am pretty sure though that we should do translation, but always prefer cgroupv2, the way that PR does it.

@poettering poettering closed this Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants