diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2009-03-31 18:19:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:11 -0400 |
commit | ee99c71c59f897436ec65debb99372b3146f9985 (patch) | |
tree | 051f1c43b7c7658689d4b2c23b3d8585d6464a89 /include/linux/mmzone.h | |
parent | a6dc60f8975ad96d162915e07703a4439c80dcf0 (diff) |
mm: introduce for_each_populated_zone() macro
Impact: cleanup
In almost cases, for_each_zone() is used with populated_zone(). It's
because almost function doesn't need memoryless node information.
Therefore, for_each_populated_zone() can help to make code simplify.
This patch has no functional change.
[akpm@linux-foundation.org: small cleanup]
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 1aca6cebbb78..26ef24076b76 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -806,6 +806,14 @@ extern struct zone *next_zone(struct zone *zone); | |||
806 | zone; \ | 806 | zone; \ |
807 | zone = next_zone(zone)) | 807 | zone = next_zone(zone)) |
808 | 808 | ||
809 | #define for_each_populated_zone(zone) \ | ||
810 | for (zone = (first_online_pgdat())->node_zones; \ | ||
811 | zone; \ | ||
812 | zone = next_zone(zone)) \ | ||
813 | if (!populated_zone(zone)) \ | ||
814 | ; /* do nothing */ \ | ||
815 | else | ||
816 | |||
809 | static inline struct zone *zonelist_zone(struct zoneref *zoneref) | 817 | static inline struct zone *zonelist_zone(struct zoneref *zoneref) |
810 | { | 818 | { |
811 | return zoneref->zone; | 819 | return zoneref->zone; |