Skip to content

Commit 0f0cace

Browse files
rgushchindennisszhou
authored andcommitted
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 <[email protected]> Signed-off-by: Dennis Zhou <[email protected]>
1 parent 8d55ba5 commit 0f0cace

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/memcontrol.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ struct mem_cgroup *root_mem_cgroup __read_mostly;
8080
DEFINE_PER_CPU(struct mem_cgroup *, int_active_memcg);
8181

8282
/* Socket memory accounting disabled? */
83-
static bool cgroup_memory_nosocket;
83+
static bool cgroup_memory_nosocket __ro_after_init;
8484

8585
/* Kernel memory accounting disabled? */
86-
static bool cgroup_memory_nokmem;
86+
static bool cgroup_memory_nokmem __ro_after_init;
8787

8888
/* Whether the swap controller is active */
8989
#ifdef CONFIG_MEMCG_SWAP
90-
bool cgroup_memory_noswap __read_mostly;
90+
bool cgroup_memory_noswap __ro_after_init;
9191
#else
9292
#define cgroup_memory_noswap 1
9393
#endif

0 commit comments

Comments
 (0)