Skip to content

Commit 86327e8

Browse files
Michal Hockoakpm00
authored andcommitted
memcg: drop kmem.limit_in_bytes
kmem.limit_in_bytes (v1 way to limit kernel memory usage) has been deprecated since 58056f7 ("memcg, kmem: further deprecate kmem.limit_in_bytes") merged in 5.16. We haven't heard about any serious users since then but it seems that the mere presence of the file is causing more harm thatn good. We (SUSE) have had several bug reports from customers where Docker based containers started to fail because a write to kmem.limit_in_bytes has failed. This was unexpected because runc code only expects ENOENT (kmem disabled) or EBUSY (tasks already running within cgroup). So a new error code was unexpected and the whole container startup failed. This has been later addressed by opencontainers/runc@52390d6 so current Docker runtimes do not suffer from the problem anymore. There are still older version of Docker in use and likely hard to get rid of completely. Address this by wiping out the file completely and effectively get back to pre 4.5 era and CONFIG_MEMCG_KMEM=n configuration. I would recommend backporting to stable trees which have picked up 58056f7 ("memcg, kmem: further deprecate kmem.limit_in_bytes"). [[email protected]: restore _KMEM switch case] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Michal Hocko <[email protected]> Acked-by: Shakeel Butt <[email protected]> Acked-by: Johannes Weiner <[email protected]> Acked-by: Roman Gushchin <[email protected]> Cc: Muchun Song <[email protected]> Cc: Tejun Heo <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 82d9b8c commit 86327e8

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

Documentation/admin-guide/cgroup-v1/memory.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ Brief summary of control files.
9292
memory.oom_control set/show oom controls.
9393
memory.numa_stat show the number of memory usage per numa
9494
node
95-
memory.kmem.limit_in_bytes This knob is deprecated and writing to
96-
it will return -ENOTSUPP.
9795
memory.kmem.usage_in_bytes show current kernel memory allocation
9896
memory.kmem.failcnt show the number of kernel memory usage
9997
hits limits

mm/memcontrol.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,10 +3871,6 @@ static ssize_t mem_cgroup_write(struct kernfs_open_file *of,
38713871
case _MEMSWAP:
38723872
ret = mem_cgroup_resize_max(memcg, nr_pages, true);
38733873
break;
3874-
case _KMEM:
3875-
/* kmem.limit_in_bytes is deprecated. */
3876-
ret = -EOPNOTSUPP;
3877-
break;
38783874
case _TCP:
38793875
ret = memcg_update_tcp_max(memcg, nr_pages);
38803876
break;
@@ -5085,12 +5081,6 @@ static struct cftype mem_cgroup_legacy_files[] = {
50855081
.seq_show = memcg_numa_stat_show,
50865082
},
50875083
#endif
5088-
{
5089-
.name = "kmem.limit_in_bytes",
5090-
.private = MEMFILE_PRIVATE(_KMEM, RES_LIMIT),
5091-
.write = mem_cgroup_write,
5092-
.read_u64 = mem_cgroup_read_u64,
5093-
},
50945084
{
50955085
.name = "kmem.usage_in_bytes",
50965086
.private = MEMFILE_PRIVATE(_KMEM, RES_USAGE),

0 commit comments

Comments
 (0)