All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kosaki.motohiro@gmail.com, akpm@linux-foundation.org
Subject: Re: [PATCH] mm: Simplify for_each_populated_zone()
Date: Fri, 19 Oct 2012 19:56:19 +0530	[thread overview]
Message-ID: <5081630B.2000004@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121019135454.GJ31863@cmpxchg.org>

On 10/19/2012 07:24 PM, Johannes Weiner wrote:
> On Fri, Oct 19, 2012 at 04:25:47PM +0530, Srivatsa S. Bhat wrote:
>> Move the check for populated_zone() to the control statement of the
>> 'for' loop and get rid of the odd looking if/else block.
>>
>> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
>> ---
>>
>>  include/linux/mmzone.h |    7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
>> index 50aaca8..5bdf02e 100644
>> --- a/include/linux/mmzone.h
>> +++ b/include/linux/mmzone.h
>> @@ -913,11 +913,8 @@ extern struct zone *next_zone(struct zone *zone);
>>  
>>  #define for_each_populated_zone(zone)		        \
>>  	for (zone = (first_online_pgdat())->node_zones; \
>> -	     zone;					\
>> -	     zone = next_zone(zone))			\
>> -		if (!populated_zone(zone))		\
>> -			; /* do nothing */		\
>> -		else
>> +	     zone && populated_zone(zone);		\
>> +	     zone = next_zone(zone))
> 
> I don't think we want to /abort/ the loop when encountering an
> unpopulated zone.
> 

Oops! I totally missed that.. thanks for catching it! Please ignore
the patch.

Regards,
Srivatsa S. Bhat

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

WARNING: multiple messages have this Message-ID (diff)
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kosaki.motohiro@gmail.com, akpm@linux-foundation.org
Subject: Re: [PATCH] mm: Simplify for_each_populated_zone()
Date: Fri, 19 Oct 2012 19:56:19 +0530	[thread overview]
Message-ID: <5081630B.2000004@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121019135454.GJ31863@cmpxchg.org>

On 10/19/2012 07:24 PM, Johannes Weiner wrote:
> On Fri, Oct 19, 2012 at 04:25:47PM +0530, Srivatsa S. Bhat wrote:
>> Move the check for populated_zone() to the control statement of the
>> 'for' loop and get rid of the odd looking if/else block.
>>
>> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
>> ---
>>
>>  include/linux/mmzone.h |    7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
>> index 50aaca8..5bdf02e 100644
>> --- a/include/linux/mmzone.h
>> +++ b/include/linux/mmzone.h
>> @@ -913,11 +913,8 @@ extern struct zone *next_zone(struct zone *zone);
>>  
>>  #define for_each_populated_zone(zone)		        \
>>  	for (zone = (first_online_pgdat())->node_zones; \
>> -	     zone;					\
>> -	     zone = next_zone(zone))			\
>> -		if (!populated_zone(zone))		\
>> -			; /* do nothing */		\
>> -		else
>> +	     zone && populated_zone(zone);		\
>> +	     zone = next_zone(zone))
> 
> I don't think we want to /abort/ the loop when encountering an
> unpopulated zone.
> 

Oops! I totally missed that.. thanks for catching it! Please ignore
the patch.

Regards,
Srivatsa S. Bhat


  reply	other threads:[~2012-10-19 14:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 10:55 [PATCH] mm: Simplify for_each_populated_zone() Srivatsa S. Bhat
2012-10-19 10:55 ` Srivatsa S. Bhat
2012-10-19 13:54 ` Johannes Weiner
2012-10-19 13:54   ` Johannes Weiner
2012-10-19 14:26   ` Srivatsa S. Bhat [this message]
2012-10-19 14:26     ` Srivatsa S. Bhat
  -- strict thread matches above, loose matches on Subject: below --
2013-04-10 20:27 Srivatsa S. Bhat
2013-04-10 20:27 ` Srivatsa S. Bhat
2013-04-10 20:41 ` David Rientjes
2013-04-10 20:41   ` David Rientjes
2013-04-10 20:42   ` Srivatsa S. Bhat
2013-04-10 20:42     ` Srivatsa S. Bhat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5081630B.2000004@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.