memcg: add BUILD_BUG_ON() for string tables
Subsystems (2)
PATCH 1/1 memcg: add BUILD_BUG_ON() for string tables
Use BUILD_BUG_ON() to compile assert that memcg string tables are in sync with corresponding enums. There aren't currently any issues with these tables. This is just defensive.
--- mm/memcontrol.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/memcontrol.c +4 -0
@@ -3699,6 +3699,10 @@ static int memcg_stat_show(struct seq_file *m, void *v)struct mem_cgroup *mi;unsigned int i; +BUILD_BUG_ON (ARRAY_SIZE (mem_cgroup_stat_names) != +MEM_CGROUP_STAT_NSTATS ); +BUILD_BUG_ON (ARRAY_SIZE (mem_cgroup_events_names) != +MEM_CGROUP_EVENTS_NSTATS );BUILD_BUG_ON (ARRAY_SIZE (mem_cgroup_lru_names) !=NR_LRU_LISTS );for (i =0 ; i <MEM_CGROUP_STAT_NSTATS ; i++) {
Signature · 7 lines
2.2.0.rc0.207.ga3a616c -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Greg Thelen
Use
BUILD_BUG_ON()to compile assert that memcg string tables are in sync with corresponding enums. There aren't currently any issues with these tables. This is just defensive.Signed-off-by Greg Thelen <[email protected]>
Looks good to me, thanks Greg.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Greg Thelen
Use
BUILD_BUG_ON()to compile assert that memcg string tables are in sync with corresponding enums. There aren't currently any issues with these tables. This is just defensive.Signed-off-by Greg Thelen <[email protected]>
Quoted 22 lines
--- mm/memcontrol.c | 4 ++++ 1 file changed, 4 insertions(+)mm/memcontrol.c +4
-0@@ -3699,6 +3699,10 @@ static int memcg_stat_show(struct seq_file *m, void *v)struct mem_cgroup *mi;unsigned int i; +BUILD_BUG_ON (ARRAY_SIZE (mem_cgroup_stat_names) != +MEM_CGROUP_STAT_NSTATS ); +BUILD_BUG_ON (ARRAY_SIZE (mem_cgroup_events_names) != +MEM_CGROUP_EVENTS_NSTATS );BUILD_BUG_ON (ARRAY_SIZE (mem_cgroup_lru_names) !=NR_LRU_LISTS );for (i =0 ; i <MEM_CGROUP_STAT_NSTATS ; i++) {Signature · 1 line
2.2.0.rc0.207.ga3a616c
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>