summaryrefslogtreecommitdiff
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2021-06-03 04:09:29 +0300
committerDennis Zhou <dennis@kernel.org>2021-06-05 23:40:59 +0300
commit0f0cace35fa655d383b64b4fce83a44d530c9aaf (patch)
tree9af377f9fc8a4e9f8eab9e4a89cc33a72a19aad0 /mm/memcontrol.c
parent8d55ba5df39a2eb213da63911c1a75001e0717fc (diff)
downloadlinux-0f0cace35fa655d383b64b4fce83a44d530c9aaf.tar.xz
mm, memcg: mark cgroup_memory_nosocket, nokmem and noswap as __ro_after_init
cgroup_memory_nosocket, cgroup_memory_nokmem and cgroup_memory_noswap are initialized during the kernel initialization and never change their value afterwards. cgroup_memory_nosocket, cgroup_memory_nokmem are written only from cgroup_memory(), which is marked as __init. cgroup_memory_noswap is written from setup_swap_account() and mem_cgroup_swap_init(), both are marked as __init. Mark all three variables as __ro_after_init. Signed-off-by: Roman Gushchin <guro@fb.com> Signed-off-by: Dennis Zhou <dennis@kernel.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e064ac0d850a..e6203ee24a11 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -80,14 +80,14 @@ struct mem_cgroup *root_mem_cgroup __read_mostly;
DEFINE_PER_CPU(struct mem_cgroup *, int_active_memcg);
/* Socket memory accounting disabled? */
-static bool cgroup_memory_nosocket;
+static bool cgroup_memory_nosocket __ro_after_init;
/* Kernel memory accounting disabled? */
-static bool cgroup_memory_nokmem;
+static bool cgroup_memory_nokmem __ro_after_init;
/* Whether the swap controller is active */
#ifdef CONFIG_MEMCG_SWAP
-bool cgroup_memory_noswap __read_mostly;
+bool cgroup_memory_noswap __ro_after_init;
#else
#define cgroup_memory_noswap 1
#endif