All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memcg: add BUILD_BUG_ON() for string tables
@ 2015-01-12 18:54 ` Greg Thelen
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Thelen @ 2015-01-12 18:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, linux-mm, linux-kernel, 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 <gthelen@google.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] memcg: add BUILD_BUG_ON() for string tables
@ 2015-01-12 18:54 ` Greg Thelen
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Thelen @ 2015-01-12 18:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, linux-mm, linux-kernel, 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 <gthelen@google.com>
---
 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] memcg: add BUILD_BUG_ON() for string tables
  2015-01-12 18:54 ` Greg Thelen
@ 2015-01-12 22:13   ` Johannes Weiner
  -1 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2015-01-12 22:13 UTC (permalink / raw)
  To: Greg Thelen; +Cc: Andrew Morton, Michal Hocko, linux-mm, linux-kernel

On Mon, Jan 12, 2015 at 10:54:23AM -0800, 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@google.com>

Looks good to me, thanks Greg.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memcg: add BUILD_BUG_ON() for string tables
@ 2015-01-12 22:13   ` Johannes Weiner
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2015-01-12 22:13 UTC (permalink / raw)
  To: Greg Thelen; +Cc: Andrew Morton, Michal Hocko, linux-mm, linux-kernel

On Mon, Jan 12, 2015 at 10:54:23AM -0800, 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@google.com>

Looks good to me, thanks Greg.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memcg: add BUILD_BUG_ON() for string tables
  2015-01-12 18:54 ` Greg Thelen
@ 2015-01-13  8:15   ` Michal Hocko
  -1 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2015-01-13  8:15 UTC (permalink / raw)
  To: Greg Thelen; +Cc: Andrew Morton, Johannes Weiner, linux-mm, linux-kernel

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@google.com>

Acked-by: Michal Hocko <mhocko@suse.cz>

> ---
>  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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] memcg: add BUILD_BUG_ON() for string tables
@ 2015-01-13  8:15   ` Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2015-01-13  8:15 UTC (permalink / raw)
  To: Greg Thelen; +Cc: Andrew Morton, Johannes Weiner, linux-mm, linux-kernel

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@google.com>

Acked-by: Michal Hocko <mhocko@suse.cz>

> ---
>  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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-13  8:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12 18:54 [PATCH] memcg: add BUILD_BUG_ON() for string tables Greg Thelen
2015-01-12 18:54 ` Greg Thelen
2015-01-12 22:13 ` Johannes Weiner
2015-01-12 22:13   ` Johannes Weiner
2015-01-13  8:15 ` Michal Hocko
2015-01-13  8:15   ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.