diff options
author | Greg Thelen <gthelen@google.com> | 2015-02-11 18:25:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:02 -0500 |
commit | 0ca44b148ef2596882742dc03ef1c3adcd40f03b (patch) | |
tree | 5bd974396d0348cb6fd03e588302c8cc50716c98 /mm/memcontrol.c | |
parent | 90cbc2508827e1e15dca23361c33cc26dd2b9e99 (diff) |
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.
Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6187ca4d5dc2..dc5c4cd0afdf 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -3568,6 +3568,10 @@ static int memcg_stat_show(struct seq_file *m, void *v) | |||
3568 | struct mem_cgroup *mi; | 3568 | struct mem_cgroup *mi; |
3569 | unsigned int i; | 3569 | unsigned int i; |
3570 | 3570 | ||
3571 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_stat_names) != | ||
3572 | MEM_CGROUP_STAT_NSTATS); | ||
3573 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_events_names) != | ||
3574 | MEM_CGROUP_EVENTS_NSTATS); | ||
3571 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); | 3575 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); |
3572 | 3576 | ||
3573 | for (i = 0; i < MEM_CGROUP_STAT_NSTATS; i++) { | 3577 | for (i = 0; i < MEM_CGROUP_STAT_NSTATS; i++) { |