core: make settings for unified cgroup hierarchy supersede the ones f…#4269
Merged
keszybz merged 1 commit intosystemd:masterfrom Oct 15, 2016
Merged
Conversation
Contributor
Contributor
Author
|
So, if either MemoryMax or MemorySwapMax is specified, the MemoryMax value (whether that's the default unlimited value or not) should be used. If neither is used, MemoryLimit is used. This should address #4096, right? |
Contributor
|
cc @walyong |
keszybz
requested changes
Oct 10, 2016
Member
keszybz
left a comment
There was a problem hiding this comment.
Yeah, I think we should do this. It doesn't preclude anyone from using the legacy hierarchy like before, but makes the preference for v2 clear, and actually simplifies things for people who are trying to support both.
Apart from a few c&p issues, looks great.
man/systemd.resource-control.xml
Outdated
| <para>Implies <literal>CPUAccounting=true</literal>.</para> | ||
|
|
||
| <para>These settings are supported only if the legacy control group hierarchy is used.</para> | ||
| <para>These settings replace <varname>CPUShares=</varname> and <varname>StartupCPUWeight=</varname>.</para> |
man/systemd.resource-control.xml
Outdated
| <para>This setting is supported only if the unified control group hierarchy is used. Use | ||
| <varname>BlockIOAccounting=</varname> on systems using the legacy control group hierarchy.</para> | ||
| <para>This setting replaces <varname>BlockIOAccounting=</varname> and disables <varname>BlockIO</varname> | ||
| prefixed settings.</para> |
Member
There was a problem hiding this comment.
BlockIO and StartupBlockIO -prefixed. Or maybe it'd be better to just list them.
man/systemd.resource-control.xml
Outdated
| <varname>BlockIOWeight=</varname> and <varname>StartupBlockIOWeight=</varname> on systems using the legacy | ||
| control group hierarchy.</para> | ||
| <para>These settings replace <varname>BlockIOWeight=</varname> and <varname>StartupBlockIOWeight=</varname> | ||
| and disable <varname>BlockIO</varname> prefixed settings.</para> |
man/systemd.resource-control.xml
Outdated
| <para>This setting is supported only if the unified control group hierarchy is used. Use | ||
| <varname>BlockIODeviceWeight=</varname> on systems using the legacy control group hierarchy.</para> | ||
| <para>This setting replaces <varname>BlockIODeviceWeight=</varname> and disables <varname>BlockIO</varname> | ||
| prefixed settings.</para> |
src/core/cgroup.c
Outdated
| LIST_FOREACH_SAFE(device_bandwidths, b, next, c->blockio_device_bandwidths) { | ||
| if (!cgroup_apply_blkio_device_limit(u, b->path, b->rbps, b->wbps)) | ||
| cgroup_context_free_blockio_device_bandwidth(c, b); | ||
| } |
src/core/cgroup.c
Outdated
| log_cgroup_compat(u, "Applying MemoryMax %" PRIi64 " as MemoryLimit", val); | ||
| } else { | ||
| val = c->memory_limit; | ||
| } |
Member
|
lgtm, besides the things @keszybz already pointed out |
…or legacy hierarchy There are overlapping control group resource settings for the unified and legacy hierarchies. To help transition, the settings are translated back and forth. When both versions of a given setting are present, the one matching the cgroup hierarchy type in use is used. Unfortunately, this is more confusing to use and document than necessary because there is no clear static precedence. Update the translation logic so that the settings for the unified hierarchy are always preferred. systemd.resource-control man page is updated to reflect the change and reorganized so that the deprecated settings are at the end in its own section.
ff4c9f8 to
3fe2c30
Compare
Contributor
Author
|
Updated as per @keszybz's comments. |
keszybz
approved these changes
Oct 14, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…or legacy hierarchy
There are overlapping control group resource settings for the unified and
legacy hierarchies. To help transition, the settings are translated back and
forth. When both versions of a given setting are present, the one matching the
cgroup hierarchy type in use is used. Unfortunately, this is more confusing to
use and document than necessary because there is no clear static precedence.
Update the translation logic so that the settings for the unified hierarchy are
always preferred. systemd.resource-control man page is updated to reflect the
change and reorganized so that the deprecated settings are at the end in its
own section.