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 /kernel/power/swsusp.c | |
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 'kernel/power/swsusp.c')
-rw-r--r-- | kernel/power/swsusp.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index a92c91451559..1ee6636414b2 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -229,17 +229,16 @@ int swsusp_shrink_memory(void) | |||
229 | size = count_data_pages() + PAGES_FOR_IO + SPARE_PAGES; | 229 | size = count_data_pages() + PAGES_FOR_IO + SPARE_PAGES; |
230 | tmp = size; | 230 | tmp = size; |
231 | size += highmem_size; | 231 | size += highmem_size; |
232 | for_each_zone (zone) | 232 | for_each_populated_zone(zone) { |
233 | if (populated_zone(zone)) { | 233 | tmp += snapshot_additional_pages(zone); |
234 | tmp += snapshot_additional_pages(zone); | 234 | if (is_highmem(zone)) { |
235 | if (is_highmem(zone)) { | 235 | highmem_size -= |
236 | highmem_size -= | ||
237 | zone_page_state(zone, NR_FREE_PAGES); | 236 | zone_page_state(zone, NR_FREE_PAGES); |
238 | } else { | 237 | } else { |
239 | tmp -= zone_page_state(zone, NR_FREE_PAGES); | 238 | tmp -= zone_page_state(zone, NR_FREE_PAGES); |
240 | tmp += zone->lowmem_reserve[ZONE_NORMAL]; | 239 | tmp += zone->lowmem_reserve[ZONE_NORMAL]; |
241 | } | ||
242 | } | 240 | } |
241 | } | ||
243 | 242 | ||
244 | if (highmem_size < 0) | 243 | if (highmem_size < 0) |
245 | highmem_size = 0; | 244 | highmem_size = 0; |