Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280640 > unrolled thread

[PATCH v1] mm: fix warning in comparing enumerator

Started byNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
First post2015-12-01 09:40 +0100
Last post2015-12-02 10:20 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1] mm: fix warning in comparing enumerator Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-12-01 09:40 +0100
    Re: [PATCH v1] mm: fix warning in comparing enumerator David Rientjes <rientjes@google.com> - 2015-12-01 23:30 +0100
      [PATCH v2] mm: fix warning in comparing enumerator Naoya Horiguchi <nao.horiguchi@gmail.com> - 2015-12-02 00:20 +0100
        Re: [PATCH v2] mm: fix warning in comparing enumerator David Rientjes <rientjes@google.com> - 2015-12-02 00:40 +0100
        Re: [PATCH v2] mm: fix warning in comparing enumerator Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2015-12-02 10:20 +0100

#1280640 — [PATCH v1] mm: fix warning in comparing enumerator

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2015-12-01 09:40 +0100
Subject[PATCH v1] mm: fix warning in comparing enumerator
Message-ID<qAODE-7cY-7@gated-at.bofh.it>
I saw the following warning when building mmotm-2015-11-25-17-08.

mm/page_alloc.c:4185:16: warning: comparison between 'enum zone_type' and 'enum <anonymous>' [-Wenum-compare]
  for (i = 0; i < MAX_ZONELISTS; i++) {
                ^

enum zone_type is named like ZONE_* which is different from ZONELIST_*, so
we are somehow doing incorrect comparison. Just fixes it.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/page_alloc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git mmotm-2015-11-25-17-08/mm/page_alloc.c mmotm-2015-11-25-17-08_patched/mm/page_alloc.c
index e267faa..b801e6f 100644
--- mmotm-2015-11-25-17-08/mm/page_alloc.c
+++ mmotm-2015-11-25-17-08_patched/mm/page_alloc.c
@@ -4174,8 +4174,7 @@ static void set_zonelist_order(void)
 
 static void build_zonelists(pg_data_t *pgdat)
 {
-	int j, node, load;
-	enum zone_type i;
+	int i, j, node, load;
 	nodemask_t used_mask;
 	int local_node, prev_node;
 	struct zonelist *zonelist;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1281265

FromDavid Rientjes <rientjes@google.com>
Date2015-12-01 23:30 +0100
Message-ID<qB1AS-79P-25@gated-at.bofh.it>
In reply to#1280640
On Tue, 1 Dec 2015, Naoya Horiguchi wrote:

> I saw the following warning when building mmotm-2015-11-25-17-08.
> 
> mm/page_alloc.c:4185:16: warning: comparison between 'enum zone_type' and 'enum <anonymous>' [-Wenum-compare]
>   for (i = 0; i < MAX_ZONELISTS; i++) {
>                 ^
> 
> enum zone_type is named like ZONE_* which is different from ZONELIST_*, so
> we are somehow doing incorrect comparison. Just fixes it.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
>  mm/page_alloc.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git mmotm-2015-11-25-17-08/mm/page_alloc.c mmotm-2015-11-25-17-08_patched/mm/page_alloc.c
> index e267faa..b801e6f 100644
> --- mmotm-2015-11-25-17-08/mm/page_alloc.c
> +++ mmotm-2015-11-25-17-08_patched/mm/page_alloc.c
> @@ -4174,8 +4174,7 @@ static void set_zonelist_order(void)
>  
>  static void build_zonelists(pg_data_t *pgdat)
>  {
> -	int j, node, load;
> -	enum zone_type i;
> +	int i, j, node, load;
>  	nodemask_t used_mask;
>  	int local_node, prev_node;
>  	struct zonelist *zonelist;

Obviously correct, but I would have thought we could just remove 'j' and 
used 'i' as our iterator through the entire function.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1281322 — [PATCH v2] mm: fix warning in comparing enumerator

FromNaoya Horiguchi <nao.horiguchi@gmail.com>
Date2015-12-02 00:20 +0100
Subject[PATCH v2] mm: fix warning in comparing enumerator
Message-ID<qB2nh-7GU-59@gated-at.bofh.it>
In reply to#1281265
On Tue, Dec 01, 2015 at 02:25:50PM -0800, David Rientjes wrote:
> On Tue, 1 Dec 2015, Naoya Horiguchi wrote:
> 
> > I saw the following warning when building mmotm-2015-11-25-17-08.
> > 
> > mm/page_alloc.c:4185:16: warning: comparison between 'enum zone_type' and 'enum <anonymous>' [-Wenum-compare]
> >   for (i = 0; i < MAX_ZONELISTS; i++) {
> >                 ^
> > 
> > enum zone_type is named like ZONE_* which is different from ZONELIST_*, so
> > we are somehow doing incorrect comparison. Just fixes it.
> > 
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> > ---
> >  mm/page_alloc.c |    3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> > 
> > diff --git mmotm-2015-11-25-17-08/mm/page_alloc.c mmotm-2015-11-25-17-08_patched/mm/page_alloc.c
> > index e267faa..b801e6f 100644
> > --- mmotm-2015-11-25-17-08/mm/page_alloc.c
> > +++ mmotm-2015-11-25-17-08_patched/mm/page_alloc.c
> > @@ -4174,8 +4174,7 @@ static void set_zonelist_order(void)
> >  
> >  static void build_zonelists(pg_data_t *pgdat)
> >  {
> > -	int j, node, load;
> > -	enum zone_type i;
> > +	int i, j, node, load;
> >  	nodemask_t used_mask;
> >  	int local_node, prev_node;
> >  	struct zonelist *zonelist;
> 
> Obviously correct, but I would have thought we could just remove 'j' and 
> used 'i' as our iterator through the entire function.

You're right, thank you.

Here is v2.

---
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Subject: [PATCH v2] mm: fix warning in comparing enumerator

I saw the following warning when building mmotm-2015-11-25-17-08.

mm/page_alloc.c:4185:16: warning: comparison between 'enum zone_type' and 'enum <anonymous>' [-Wenum-compare]
  for (i = 0; i < MAX_ZONELISTS; i++) {
                ^

enum zone_type is named like ZONE_* which is different from ZONELIST_*, so
we are somehow doing incorrect comparison. Just fixes it.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
v1 -> v2:
- remove 'j'
---
 mm/page_alloc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e267faad4649..54fcd0a60d5e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4174,8 +4174,7 @@ static void set_zonelist_order(void)
 
 static void build_zonelists(pg_data_t *pgdat)
 {
-	int j, node, load;
-	enum zone_type i;
+	int i, node, load;
 	nodemask_t used_mask;
 	int local_node, prev_node;
 	struct zonelist *zonelist;
@@ -4195,7 +4194,7 @@ static void build_zonelists(pg_data_t *pgdat)
 	nodes_clear(used_mask);
 
 	memset(node_order, 0, sizeof(node_order));
-	j = 0;
+	i = 0;
 
 	while ((node = find_next_best_node(local_node, &used_mask)) >= 0) {
 		/*
@@ -4212,12 +4211,12 @@ static void build_zonelists(pg_data_t *pgdat)
 		if (order == ZONELIST_ORDER_NODE)
 			build_zonelists_in_node_order(pgdat, node);
 		else
-			node_order[j++] = node;	/* remember order */
+			node_order[i++] = node;	/* remember order */
 	}
 
 	if (order == ZONELIST_ORDER_ZONE) {
 		/* calculate node order -- i.e., DMA last! */
-		build_zonelists_in_zone_order(pgdat, j);
+		build_zonelists_in_zone_order(pgdat, i);
 	}
 
 	build_thisnode_zonelists(pgdat);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1281344 — Re: [PATCH v2] mm: fix warning in comparing enumerator

FromDavid Rientjes <rientjes@google.com>
Date2015-12-02 00:40 +0100
SubjectRe: [PATCH v2] mm: fix warning in comparing enumerator
Message-ID<qB2GD-7Ot-23@gated-at.bofh.it>
In reply to#1281322
On Wed, 2 Dec 2015, Naoya Horiguchi wrote:

> From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Subject: [PATCH v2] mm: fix warning in comparing enumerator
> 
> I saw the following warning when building mmotm-2015-11-25-17-08.
> 
> mm/page_alloc.c:4185:16: warning: comparison between 'enum zone_type' and 'enum <anonymous>' [-Wenum-compare]
>   for (i = 0; i < MAX_ZONELISTS; i++) {
>                 ^
> 
> enum zone_type is named like ZONE_* which is different from ZONELIST_*, so
> we are somehow doing incorrect comparison. Just fixes it.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Acked-by: David Rientjes <rientjes@google.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1281538 — Re: [PATCH v2] mm: fix warning in comparing enumerator

FromYaowei Bai <baiyaowei@cmss.chinamobile.com>
Date2015-12-02 10:20 +0100
SubjectRe: [PATCH v2] mm: fix warning in comparing enumerator
Message-ID<qBbJT-5dP-11@gated-at.bofh.it>
In reply to#1281322
On Wed, Dec 02, 2015 at 08:07:42AM +0900, Naoya Horiguchi wrote:
> On Tue, Dec 01, 2015 at 02:25:50PM -0800, David Rientjes wrote:
> > On Tue, 1 Dec 2015, Naoya Horiguchi wrote:
> 
> I saw the following warning when building mmotm-2015-11-25-17-08.
> 
> mm/page_alloc.c:4185:16: warning: comparison between 'enum zone_type' and 'enum <anonymous>' [-Wenum-compare]
>   for (i = 0; i < MAX_ZONELISTS; i++) {
>                 ^
> 
> enum zone_type is named like ZONE_* which is different from ZONELIST_*, so
> we are somehow doing incorrect comparison. Just fixes it.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Acked-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web