diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2012-07-31 19:43:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-31 21:42:44 -0400 |
commit | 4ed7e02222aba062bd0ed3ab12dfc8e9fc0467b5 (patch) | |
tree | 82e6c1c3bc30cab1220c97797bd68a60bd98cab2 /mm/page_alloc.c | |
parent | 340175b7d14d5617559d0c1a54fa0ea204d9edcd (diff) |
mm/hotplug: mark memory hotplug code in page_alloc.c as __meminit
Mark functions used by both boot and memory hotplug as __meminit to reduce
memory footprint when memory hotplug is disabled.
Alos guard zone_pcp_update() with CONFIG_MEMORY_HOTPLUG because it's only
used by memory hotplug code.
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Cc: Wei Wang <Bessel.Wang@huawei.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Keping Chen <chenkeping@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9c9a31665a78..667338e80e94 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3411,7 +3411,7 @@ static void setup_zone_pageset(struct zone *zone); | |||
3411 | DEFINE_MUTEX(zonelists_mutex); | 3411 | DEFINE_MUTEX(zonelists_mutex); |
3412 | 3412 | ||
3413 | /* return values int ....just for stop_machine() */ | 3413 | /* return values int ....just for stop_machine() */ |
3414 | static __init_refok int __build_all_zonelists(void *data) | 3414 | static int __build_all_zonelists(void *data) |
3415 | { | 3415 | { |
3416 | int nid; | 3416 | int nid; |
3417 | int cpu; | 3417 | int cpu; |
@@ -3755,7 +3755,7 @@ static void __meminit zone_init_free_lists(struct zone *zone) | |||
3755 | memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) | 3755 | memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) |
3756 | #endif | 3756 | #endif |
3757 | 3757 | ||
3758 | static int zone_batchsize(struct zone *zone) | 3758 | static int __meminit zone_batchsize(struct zone *zone) |
3759 | { | 3759 | { |
3760 | #ifdef CONFIG_MMU | 3760 | #ifdef CONFIG_MMU |
3761 | int batch; | 3761 | int batch; |
@@ -3837,7 +3837,7 @@ static void setup_pagelist_highmark(struct per_cpu_pageset *p, | |||
3837 | pcp->batch = PAGE_SHIFT * 8; | 3837 | pcp->batch = PAGE_SHIFT * 8; |
3838 | } | 3838 | } |
3839 | 3839 | ||
3840 | static void setup_zone_pageset(struct zone *zone) | 3840 | static void __meminit setup_zone_pageset(struct zone *zone) |
3841 | { | 3841 | { |
3842 | int cpu; | 3842 | int cpu; |
3843 | 3843 | ||
@@ -3910,33 +3910,6 @@ int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages) | |||
3910 | return 0; | 3910 | return 0; |
3911 | } | 3911 | } |
3912 | 3912 | ||
3913 | static int __zone_pcp_update(void *data) | ||
3914 | { | ||
3915 | struct zone *zone = data; | ||
3916 | int cpu; | ||
3917 | unsigned long batch = zone_batchsize(zone), flags; | ||
3918 | |||
3919 | for_each_possible_cpu(cpu) { | ||
3920 | struct per_cpu_pageset *pset; | ||
3921 | struct per_cpu_pages *pcp; | ||
3922 | |||
3923 | pset = per_cpu_ptr(zone->pageset, cpu); | ||
3924 | pcp = &pset->pcp; | ||
3925 | |||
3926 | local_irq_save(flags); | ||
3927 | if (pcp->count > 0) | ||
3928 | free_pcppages_bulk(zone, pcp->count, pcp); | ||
3929 | setup_pageset(pset, batch); | ||
3930 | local_irq_restore(flags); | ||
3931 | } | ||
3932 | return 0; | ||
3933 | } | ||
3934 | |||
3935 | void zone_pcp_update(struct zone *zone) | ||
3936 | { | ||
3937 | stop_machine(__zone_pcp_update, zone, NULL); | ||
3938 | } | ||
3939 | |||
3940 | static __meminit void zone_pcp_init(struct zone *zone) | 3913 | static __meminit void zone_pcp_init(struct zone *zone) |
3941 | { | 3914 | { |
3942 | /* | 3915 | /* |
@@ -3952,7 +3925,7 @@ static __meminit void zone_pcp_init(struct zone *zone) | |||
3952 | zone_batchsize(zone)); | 3925 | zone_batchsize(zone)); |
3953 | } | 3926 | } |
3954 | 3927 | ||
3955 | __meminit int init_currently_empty_zone(struct zone *zone, | 3928 | int __meminit init_currently_empty_zone(struct zone *zone, |
3956 | unsigned long zone_start_pfn, | 3929 | unsigned long zone_start_pfn, |
3957 | unsigned long size, | 3930 | unsigned long size, |
3958 | enum memmap_context context) | 3931 | enum memmap_context context) |
@@ -4765,7 +4738,7 @@ out: | |||
4765 | } | 4738 | } |
4766 | 4739 | ||
4767 | /* Any regular memory on that node ? */ | 4740 | /* Any regular memory on that node ? */ |
4768 | static void check_for_regular_memory(pg_data_t *pgdat) | 4741 | static void __init check_for_regular_memory(pg_data_t *pgdat) |
4769 | { | 4742 | { |
4770 | #ifdef CONFIG_HIGHMEM | 4743 | #ifdef CONFIG_HIGHMEM |
4771 | enum zone_type zone_type; | 4744 | enum zone_type zone_type; |
@@ -5893,6 +5866,35 @@ void free_contig_range(unsigned long pfn, unsigned nr_pages) | |||
5893 | } | 5866 | } |
5894 | #endif | 5867 | #endif |
5895 | 5868 | ||
5869 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
5870 | static int __meminit __zone_pcp_update(void *data) | ||
5871 | { | ||
5872 | struct zone *zone = data; | ||
5873 | int cpu; | ||
5874 | unsigned long batch = zone_batchsize(zone), flags; | ||
5875 | |||
5876 | for_each_possible_cpu(cpu) { | ||
5877 | struct per_cpu_pageset *pset; | ||
5878 | struct per_cpu_pages *pcp; | ||
5879 | |||
5880 | pset = per_cpu_ptr(zone->pageset, cpu); | ||
5881 | pcp = &pset->pcp; | ||
5882 | |||
5883 | local_irq_save(flags); | ||
5884 | if (pcp->count > 0) | ||
5885 | free_pcppages_bulk(zone, pcp->count, pcp); | ||
5886 | setup_pageset(pset, batch); | ||
5887 | local_irq_restore(flags); | ||
5888 | } | ||
5889 | return 0; | ||
5890 | } | ||
5891 | |||
5892 | void __meminit zone_pcp_update(struct zone *zone) | ||
5893 | { | ||
5894 | stop_machine(__zone_pcp_update, zone, NULL); | ||
5895 | } | ||
5896 | #endif | ||
5897 | |||
5896 | #ifdef CONFIG_MEMORY_HOTREMOVE | 5898 | #ifdef CONFIG_MEMORY_HOTREMOVE |
5897 | void zone_pcp_reset(struct zone *zone) | 5899 | void zone_pcp_reset(struct zone *zone) |
5898 | { | 5900 | { |