linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Simplify for_each_populated_zone()
@ 2013-04-10 20:27 Srivatsa S. Bhat
  2013-04-10 20:41 ` David Rientjes
  0 siblings, 1 reply; 6+ messages in thread
From: Srivatsa S. Bhat @ 2013-04-10 20:27 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Srivatsa S. Bhat, KOSAKI Motohiro,
	KAMEZAWA Hiroyuki, Johannes Weiner, Mel Gorman, Andrew Morton

Simplify the if/else block to make it more readable.

Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 include/linux/mmzone.h |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ede2749..2489042 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -948,9 +948,7 @@ extern struct zone *next_zone(struct zone *zone);
 	for (zone = (first_online_pgdat())->node_zones; \
 	     zone;					\
 	     zone = next_zone(zone))			\
-		if (!populated_zone(zone))		\
-			; /* do nothing */		\
-		else
+		if (populated_zone(zone))
 
 static inline struct zone *zonelist_zone(struct zoneref *zoneref)
 {

--
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
* [PATCH] mm: Simplify for_each_populated_zone()
@ 2012-10-19 10:55 Srivatsa S. Bhat
  2012-10-19 13:54 ` Johannes Weiner
  0 siblings, 1 reply; 6+ messages in thread
From: Srivatsa S. Bhat @ 2012-10-19 10:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, kosaki.motohiro, akpm, hannes, srivatsa.bhat

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))
 
 static inline struct zone *zonelist_zone(struct zoneref *zoneref)
 {

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

end of thread, other threads:[~2013-04-10 20:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 20:27 [PATCH] mm: Simplify for_each_populated_zone() Srivatsa S. Bhat
2013-04-10 20:41 ` David Rientjes
2013-04-10 20:42   ` Srivatsa S. Bhat
  -- strict thread matches above, loose matches on Subject: below --
2012-10-19 10:55 Srivatsa S. Bhat
2012-10-19 13:54 ` Johannes Weiner
2012-10-19 14:26   ` Srivatsa S. Bhat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).