diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-07-03 18:03:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:07:35 -0400 |
commit | 7ee3d4e8cd560500192d80ca84d7f15d6dee0807 (patch) | |
tree | 8c58a121edb9c528fb6497e04774dca8d121aa4f /include/linux/mm.h | |
parent | a214a8c68bcdef2fb0803425f7fe36fe41030d3f (diff) |
mm: introduce helper function mem_init_print_info() to simplify mem_init()
Introduce helper function mem_init_print_info() to simplify mem_init()
across different architectures, which also unifies the format and
information printed.
Function mem_init_print_info() calculates memory statistics information
without walking each page, so it should be a little faster on some
architectures.
Also introduce another helper get_num_physpages() to kill the global
variable num_physpages.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 4310f80ce956..09c235301dbb 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1323,6 +1323,7 @@ extern void free_highmem_page(struct page *page); | |||
1323 | #endif | 1323 | #endif |
1324 | 1324 | ||
1325 | extern void adjust_managed_page_count(struct page *page, long count); | 1325 | extern void adjust_managed_page_count(struct page *page, long count); |
1326 | extern void mem_init_print_info(const char *str); | ||
1326 | 1327 | ||
1327 | /* Free the reserved page into the buddy system, so it gets managed. */ | 1328 | /* Free the reserved page into the buddy system, so it gets managed. */ |
1328 | static inline void __free_reserved_page(struct page *page) | 1329 | static inline void __free_reserved_page(struct page *page) |
@@ -1358,6 +1359,17 @@ static inline unsigned long free_initmem_default(int poison) | |||
1358 | poison, "unused kernel"); | 1359 | poison, "unused kernel"); |
1359 | } | 1360 | } |
1360 | 1361 | ||
1362 | static inline unsigned long get_num_physpages(void) | ||
1363 | { | ||
1364 | int nid; | ||
1365 | unsigned long phys_pages = 0; | ||
1366 | |||
1367 | for_each_online_node(nid) | ||
1368 | phys_pages += node_present_pages(nid); | ||
1369 | |||
1370 | return phys_pages; | ||
1371 | } | ||
1372 | |||
1361 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 1373 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
1362 | /* | 1374 | /* |
1363 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its | 1375 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its |