Skip to content

Commit c808f46

Browse files
committed
cgroup: remove "no" prefixed mount options
3031273 ("cgroup: Add "no" prefixed mount options") added "no" prefixed mount options to allow turning them off and 6a010a4 ("cgroup: Make !percpu threadgroup_rwsem operations optional") added one more "no" prefixed mount option. However, Michal pointed out that the "no" prefixed options aren't necessary in allowing mount options to be turned off: # grep group /proc/mounts cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,relatime,nsdelegate,memory_recursiveprot 0 0 # mount -o remount,nsdelegate,memory_recursiveprot none /sys/fs/cgroup # grep cgroup /proc/mounts cgroup2 /sys/fs/cgroup cgroup2 rw,relatime,nsdelegate,memory_recursiveprot 0 0 Note that this is different from the remount behavior when the mount(1) is invoked without the device argument - "none": # grep cgroup /proc/mounts cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 # mount -o remount,nsdelegate,memory_recursiveprot /sys/fs/cgroup # grep cgroup /proc/mounts cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 While a bit confusing, given that there is a way to turn off the options, there's no reason to have the explicit "no" prefixed options. Let's remove them. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Michal Koutný <mkoutny@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 6a010a4 commit c808f46

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,30 +177,30 @@ disabling controllers in v1 and make them always available in v2.
177177

178178
cgroup v2 currently supports the following mount options.
179179

180-
[no]nsdelegate
180+
nsdelegate
181181
Consider cgroup namespaces as delegation boundaries. This
182182
option is system wide and can only be set on mount or modified
183183
through remount from the init namespace. The mount option is
184184
ignored on non-init namespace mounts. Please refer to the
185185
Delegation section for details.
186186

187-
[no]favordynmods
187+
favordynmods
188188
Reduce the latencies of dynamic cgroup modifications such as
189189
task migrations and controller on/offs at the cost of making
190190
hot path operations such as forks and exits more expensive.
191191
The static usage pattern of creating a cgroup, enabling
192192
controllers, and then seeding it with CLONE_INTO_CGROUP is
193193
not affected by this option.
194194

195-
memory_[no]localevents
195+
memory_localevents
196196
Only populate memory.events with data for the current cgroup,
197197
and not any subtrees. This is legacy behaviour, the default
198198
behaviour without this option is to include subtree counts.
199199
This option is system wide and can only be set on mount or
200200
modified through remount from the init namespace. The mount
201201
option is ignored on non-init namespace mounts.
202202

203-
memory_[no]recursiveprot
203+
memory_recursiveprot
204204
Recursively apply memory.min and memory.low protection to
205205
entire subtrees, without requiring explicit downward
206206
propagation into leaf cgroups. This allows protecting entire

kernel/cgroup/cgroup.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,22 +1872,18 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node,
18721872
}
18731873

18741874
enum cgroup2_param {
1875-
Opt_nsdelegate, Opt_nonsdelegate,
1876-
Opt_favordynmods, Opt_nofavordynmods,
1877-
Opt_memory_localevents, Opt_memory_nolocalevents,
1878-
Opt_memory_recursiveprot, Opt_memory_norecursiveprot,
1875+
Opt_nsdelegate,
1876+
Opt_favordynmods,
1877+
Opt_memory_localevents,
1878+
Opt_memory_recursiveprot,
18791879
nr__cgroup2_params
18801880
};
18811881

18821882
static const struct fs_parameter_spec cgroup2_fs_parameters[] = {
18831883
fsparam_flag("nsdelegate", Opt_nsdelegate),
1884-
fsparam_flag("nonsdelegate", Opt_nonsdelegate),
18851884
fsparam_flag("favordynmods", Opt_favordynmods),
1886-
fsparam_flag("nofavordynmods", Opt_nofavordynmods),
18871885
fsparam_flag("memory_localevents", Opt_memory_localevents),
1888-
fsparam_flag("memory_nolocalevents", Opt_memory_nolocalevents),
18891886
fsparam_flag("memory_recursiveprot", Opt_memory_recursiveprot),
1890-
fsparam_flag("memory_norecursiveprot", Opt_memory_norecursiveprot),
18911887
{}
18921888
};
18931889

@@ -1905,27 +1901,15 @@ static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param
19051901
case Opt_nsdelegate:
19061902
ctx->flags |= CGRP_ROOT_NS_DELEGATE;
19071903
return 0;
1908-
case Opt_nonsdelegate:
1909-
ctx->flags &= ~CGRP_ROOT_NS_DELEGATE;
1910-
return 0;
19111904
case Opt_favordynmods:
19121905
ctx->flags |= CGRP_ROOT_FAVOR_DYNMODS;
19131906
return 0;
1914-
case Opt_nofavordynmods:
1915-
ctx->flags &= ~CGRP_ROOT_FAVOR_DYNMODS;
1916-
return 0;
19171907
case Opt_memory_localevents:
19181908
ctx->flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS;
19191909
return 0;
1920-
case Opt_memory_nolocalevents:
1921-
ctx->flags &= ~CGRP_ROOT_MEMORY_LOCAL_EVENTS;
1922-
return 0;
19231910
case Opt_memory_recursiveprot:
19241911
ctx->flags |= CGRP_ROOT_MEMORY_RECURSIVE_PROT;
19251912
return 0;
1926-
case Opt_memory_norecursiveprot:
1927-
ctx->flags &= ~CGRP_ROOT_MEMORY_RECURSIVE_PROT;
1928-
return 0;
19291913
}
19301914
return -EINVAL;
19311915
}

0 commit comments

Comments
 (0)