Commit 061f67bc4d053e03970a268fca99a55b6859f301

Authored by Rasmus Villemoes
Committed by Linus Torvalds
1 parent fc5199d1a9

mm/page_alloc.c: pull out init code from build_all_zonelists

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>

Showing 1 changed file with 14 additions and 3 deletions Side-by-side Diff

... ... @@ -3871,18 +3871,29 @@
3871 3871 return 0;
3872 3872 }
3873 3873  
  3874 +static noinline void __init
  3875 +build_all_zonelists_init(void)
  3876 +{
  3877 + __build_all_zonelists(NULL);
  3878 + mminit_verify_zonelist();
  3879 + cpuset_init_current_mems_allowed();
  3880 +}
  3881 +
3874 3882 /*
3875 3883 * Called with zonelists_mutex held always
3876 3884 * unless system_state == SYSTEM_BOOTING.
  3885 + *
  3886 + * __ref due to (1) call of __meminit annotated setup_zone_pageset
  3887 + * [we're only called with non-NULL zone through __meminit paths] and
  3888 + * (2) call of __init annotated helper build_all_zonelists_init
  3889 + * [protected by SYSTEM_BOOTING].
3877 3890 */
3878 3891 void __ref build_all_zonelists(pg_data_t *pgdat, struct zone *zone)
3879 3892 {
3880 3893 set_zonelist_order();
3881 3894  
3882 3895 if (system_state == SYSTEM_BOOTING) {
3883   - __build_all_zonelists(NULL);
3884   - mminit_verify_zonelist();
3885   - cpuset_init_current_mems_allowed();
  3896 + build_all_zonelists_init();
3886 3897 } else {
3887 3898 #ifdef CONFIG_MEMORY_HOTPLUG
3888 3899 if (zone)