Re: [PATCH v5 1/3] memcg: increase the valid index range for memcg stats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> >  #define NR_MEMCG_NODE_STAT_ITEMS ARRAY_SIZE(memcg_node_stat_items)
> >  #define MEMCG_VMSTAT_SIZE (NR_MEMCG_NODE_STAT_ITEMS + \
> >                            ARRAY_SIZE(memcg_stat_items))
> > -static int8_t mem_cgroup_stats_index[MEMCG_NR_STAT] __read_mostly;
> > +#define IS_INVALID(index) ((index) == U8_MAX)
>
> The use of this macro extends well into this file, should we use a
> more specific name (e.g. IS_VALID_STATS_IDX())?

I will redefine it like this:
#define BAD_STAT_IDX(index) ((u32)(index) >= U8_MAX)

1. A descriptive yet short name.
2. Check if the index is equal or larger than U8_MAX, which feels safer.

Pasha




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux