Re: [PATCH] memcg: add BUILD_BUG_ON() for string tables
From: Michal Hocko
Date: Tue Jan 13 2015 - 03:15:45 EST
On Mon 12-01-15 10:54:23, Greg Thelen wrote:
> 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@xxxxxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxx>
> ---
> mm/memcontrol.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index ef91e856c7e4..8d1ca6c55480 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -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++) {
> --
> 2.2.0.rc0.207.ga3a616c
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/