diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2016-05-19 20:12:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-19 22:12:14 -0400 |
commit | 33499bfe507c844f2c6f55ae8cec17705d0eda95 (patch) | |
tree | 04fb436b684d7ca001a6bb1e3d68f874fca5954b | |
parent | fc2bd799c7c79c84a59da6f9221370bc6f38c503 (diff) |
mm/highmem: make nr_free_highpages() handles all highmem zones by itself
nr_free_highpages() manually adds statistics per each highmem zone and
returns a total value for them. Whenever we add a new highmem zone, we
need to consider this function and it's really troublesome. Make it
handle all highmem zones by itself.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Laura Abbott <lauraa@codeaurora.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/highmem.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mm/highmem.c b/mm/highmem.c index 123bcd3ed4f2..50b4ca6787f0 100644 --- a/mm/highmem.c +++ b/mm/highmem.c | |||
@@ -112,16 +112,12 @@ EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx); | |||
112 | 112 | ||
113 | unsigned int nr_free_highpages (void) | 113 | unsigned int nr_free_highpages (void) |
114 | { | 114 | { |
115 | pg_data_t *pgdat; | 115 | struct zone *zone; |
116 | unsigned int pages = 0; | 116 | unsigned int pages = 0; |
117 | 117 | ||
118 | for_each_online_pgdat(pgdat) { | 118 | for_each_populated_zone(zone) { |
119 | pages += zone_page_state(&pgdat->node_zones[ZONE_HIGHMEM], | 119 | if (is_highmem(zone)) |
120 | NR_FREE_PAGES); | 120 | pages += zone_page_state(zone, NR_FREE_PAGES); |
121 | if (zone_movable_is_highmem()) | ||
122 | pages += zone_page_state( | ||
123 | &pgdat->node_zones[ZONE_MOVABLE], | ||
124 | NR_FREE_PAGES); | ||
125 | } | 121 | } |
126 | 122 | ||
127 | return pages; | 123 | return pages; |