mm/page_alloc.c: pull out init code from build_all_zonelists
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Thu, 12 Feb 2015 23:00:06 +0000 (15:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Feb 2015 02:54:11 +0000 (18:54 -0800)
Pulling the code protected by if (system_state == SYSTEM_BOOTING) into
its own helper allows us to shrink .text a little. This relies on
build_all_zonelists already having a __ref annotation. Add a comment
explaining why so one doesn't have to track it down through git log.

The real saving comes in 3/5, ("mm/mm_init.c: Mark mminit_verify_zonelist
as __init"), where we save about 400 bytes

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Vishnu Pratap Singh <vishnu.ps@samsung.com>
Cc: Pintu Kumar <pintu.k@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c

index 8d52ab18fe0dac09a084f945a01e8248ec260d7b..375327b8e9322eae68d9392f6d8e539d80d6550f 100644 (file)
@@ -3871,18 +3871,29 @@ static int __build_all_zonelists(void *data)
        return 0;
 }
 
+static noinline void __init
+build_all_zonelists_init(void)
+{
+       __build_all_zonelists(NULL);
+       mminit_verify_zonelist();
+       cpuset_init_current_mems_allowed();
+}
+
 /*
  * Called with zonelists_mutex held always
  * unless system_state == SYSTEM_BOOTING.
+ *
+ * __ref due to (1) call of __meminit annotated setup_zone_pageset
+ * [we're only called with non-NULL zone through __meminit paths] and
+ * (2) call of __init annotated helper build_all_zonelists_init
+ * [protected by SYSTEM_BOOTING].
  */
 void __ref build_all_zonelists(pg_data_t *pgdat, struct zone *zone)
 {
        set_zonelist_order();
 
        if (system_state == SYSTEM_BOOTING) {
-               __build_all_zonelists(NULL);
-               mminit_verify_zonelist();
-               cpuset_init_current_mems_allowed();
+               build_all_zonelists_init();
        } else {
 #ifdef CONFIG_MEMORY_HOTPLUG
                if (zone)