aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/mempolicy.c4
-rw-r--r--mm/page-writeback.c2
-rw-r--r--mm/page_alloc.c69
-rw-r--r--mm/shmem.c13
4 files changed, 50 insertions, 38 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0d70fb7d83be..2c521defb41e 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -126,7 +126,7 @@ static int mpol_check_policy(int mode, nodemask_t *nodes)
126 return -EINVAL; 126 return -EINVAL;
127 break; 127 break;
128 } 128 }
129 return nodes_subset(*nodes, node_online_map) ? 0 : -EINVAL; 129 return nodes_subset(*nodes, node_states[N_HIGH_MEMORY]) ? 0 : -EINVAL;
130} 130}
131 131
132/* Generate a custom zonelist for the BIND policy. */ 132/* Generate a custom zonelist for the BIND policy. */
@@ -965,7 +965,7 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
965 goto out; 965 goto out;
966 } 966 }
967 967
968 if (!nodes_subset(new, node_online_map)) { 968 if (!nodes_subset(new, node_states[N_HIGH_MEMORY])) {
969 err = -EINVAL; 969 err = -EINVAL;
970 goto out; 970 goto out;
971 } 971 }
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 2adb89959885..d821321326e3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -126,7 +126,7 @@ static unsigned long highmem_dirtyable_memory(unsigned long total)
126 int node; 126 int node;
127 unsigned long x = 0; 127 unsigned long x = 0;
128 128
129 for_each_online_node(node) { 129 for_each_node_state(node, N_HIGH_MEMORY) {
130 struct zone *z = 130 struct zone *z =
131 &NODE_DATA(node)->node_zones[ZONE_HIGHMEM]; 131 &NODE_DATA(node)->node_zones[ZONE_HIGHMEM];
132 132
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2f547f45de18..e69f19e841e5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1040,7 +1040,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
1040 * 1040 *
1041 * If the zonelist cache is present in the passed in zonelist, then 1041 * If the zonelist cache is present in the passed in zonelist, then
1042 * returns a pointer to the allowed node mask (either the current 1042 * returns a pointer to the allowed node mask (either the current
1043 * tasks mems_allowed, or node_online_map.) 1043 * tasks mems_allowed, or node_states[N_HIGH_MEMORY].)
1044 * 1044 *
1045 * If the zonelist cache is not available for this zonelist, does 1045 * If the zonelist cache is not available for this zonelist, does
1046 * nothing and returns NULL. 1046 * nothing and returns NULL.
@@ -1069,7 +1069,7 @@ static nodemask_t *zlc_setup(struct zonelist *zonelist, int alloc_flags)
1069 1069
1070 allowednodes = !in_interrupt() && (alloc_flags & ALLOC_CPUSET) ? 1070 allowednodes = !in_interrupt() && (alloc_flags & ALLOC_CPUSET) ?
1071 &cpuset_current_mems_allowed : 1071 &cpuset_current_mems_allowed :
1072 &node_online_map; 1072 &node_states[N_HIGH_MEMORY];
1073 return allowednodes; 1073 return allowednodes;
1074} 1074}
1075 1075
@@ -1802,7 +1802,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
1802 return node; 1802 return node;
1803 } 1803 }
1804 1804
1805 for_each_online_node(n) { 1805 for_each_node_state(n, N_HIGH_MEMORY) {
1806 cpumask_t tmp; 1806 cpumask_t tmp;
1807 1807
1808 /* Don't want a node to appear more than once */ 1808 /* Don't want a node to appear more than once */
@@ -1939,7 +1939,8 @@ static int default_zonelist_order(void)
1939 * If there is a node whose DMA/DMA32 memory is very big area on 1939 * If there is a node whose DMA/DMA32 memory is very big area on
1940 * local memory, NODE_ORDER may be suitable. 1940 * local memory, NODE_ORDER may be suitable.
1941 */ 1941 */
1942 average_size = total_size / (num_online_nodes() + 1); 1942 average_size = total_size /
1943 (nodes_weight(node_states[N_HIGH_MEMORY]) + 1);
1943 for_each_online_node(nid) { 1944 for_each_online_node(nid) {
1944 low_kmem_size = 0; 1945 low_kmem_size = 0;
1945 total_size = 0; 1946 total_size = 0;
@@ -2098,20 +2099,6 @@ static void build_zonelist_cache(pg_data_t *pgdat)
2098 2099
2099#endif /* CONFIG_NUMA */ 2100#endif /* CONFIG_NUMA */
2100 2101
2101/* Any regular memory on that node ? */
2102static void check_for_regular_memory(pg_data_t *pgdat)
2103{
2104#ifdef CONFIG_HIGHMEM
2105 enum zone_type zone_type;
2106
2107 for (zone_type = 0; zone_type <= ZONE_NORMAL; zone_type++) {
2108 struct zone *zone = &pgdat->node_zones[zone_type];
2109 if (zone->present_pages)
2110 node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY);
2111 }
2112#endif
2113}
2114
2115/* return values int ....just for stop_machine_run() */ 2102/* return values int ....just for stop_machine_run() */
2116static int __build_all_zonelists(void *dummy) 2103static int __build_all_zonelists(void *dummy)
2117{ 2104{
@@ -2122,11 +2109,6 @@ static int __build_all_zonelists(void *dummy)
2122 2109
2123 build_zonelists(pgdat); 2110 build_zonelists(pgdat);
2124 build_zonelist_cache(pgdat); 2111 build_zonelist_cache(pgdat);
2125
2126 /* Any memory on that node */
2127 if (pgdat->node_present_pages)
2128 node_set_state(nid, N_HIGH_MEMORY);
2129 check_for_regular_memory(pgdat);
2130 } 2112 }
2131 return 0; 2113 return 0;
2132} 2114}
@@ -3282,16 +3264,24 @@ unsigned long __init find_max_pfn_with_active_regions(void)
3282 return max_pfn; 3264 return max_pfn;
3283} 3265}
3284 3266
3267/*
3268 * early_calculate_totalpages()
3269 * Sum pages in active regions for movable zone.
3270 * Populate N_HIGH_MEMORY for calculating usable_nodes.
3271 */
3285unsigned long __init early_calculate_totalpages(void) 3272unsigned long __init early_calculate_totalpages(void)
3286{ 3273{
3287 int i; 3274 int i;
3288 unsigned long totalpages = 0; 3275 unsigned long totalpages = 0;
3289 3276
3290 for (i = 0; i < nr_nodemap_entries; i++) 3277 for (i = 0; i < nr_nodemap_entries; i++) {
3291 totalpages += early_node_map[i].end_pfn - 3278 unsigned long pages = early_node_map[i].end_pfn -
3292 early_node_map[i].start_pfn; 3279 early_node_map[i].start_pfn;
3293 3280 totalpages += pages;
3294 return totalpages; 3281 if (pages)
3282 node_set_state(early_node_map[i].nid, N_HIGH_MEMORY);
3283 }
3284 return totalpages;
3295} 3285}
3296 3286
3297/* 3287/*
@@ -3305,7 +3295,8 @@ void __init find_zone_movable_pfns_for_nodes(unsigned long *movable_pfn)
3305 int i, nid; 3295 int i, nid;
3306 unsigned long usable_startpfn; 3296 unsigned long usable_startpfn;
3307 unsigned long kernelcore_node, kernelcore_remaining; 3297 unsigned long kernelcore_node, kernelcore_remaining;
3308 int usable_nodes = num_online_nodes(); 3298 unsigned long totalpages = early_calculate_totalpages();
3299 int usable_nodes = nodes_weight(node_states[N_HIGH_MEMORY]);
3309 3300
3310 /* 3301 /*
3311 * If movablecore was specified, calculate what size of 3302 * If movablecore was specified, calculate what size of
@@ -3316,7 +3307,6 @@ void __init find_zone_movable_pfns_for_nodes(unsigned long *movable_pfn)
3316 * what movablecore would have allowed. 3307 * what movablecore would have allowed.
3317 */ 3308 */
3318 if (required_movablecore) { 3309 if (required_movablecore) {
3319 unsigned long totalpages = early_calculate_totalpages();
3320 unsigned long corepages; 3310 unsigned long corepages;
3321 3311
3322 /* 3312 /*
@@ -3341,7 +3331,7 @@ void __init find_zone_movable_pfns_for_nodes(unsigned long *movable_pfn)
3341restart: 3331restart:
3342 /* Spread kernelcore memory as evenly as possible throughout nodes */ 3332 /* Spread kernelcore memory as evenly as possible throughout nodes */
3343 kernelcore_node = required_kernelcore / usable_nodes; 3333 kernelcore_node = required_kernelcore / usable_nodes;
3344 for_each_online_node(nid) { 3334 for_each_node_state(nid, N_HIGH_MEMORY) {
3345 /* 3335 /*
3346 * Recalculate kernelcore_node if the division per node 3336 * Recalculate kernelcore_node if the division per node
3347 * now exceeds what is necessary to satisfy the requested 3337 * now exceeds what is necessary to satisfy the requested
@@ -3433,6 +3423,20 @@ restart:
3433 roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES); 3423 roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES);
3434} 3424}
3435 3425
3426/* Any regular memory on that node ? */
3427static void check_for_regular_memory(pg_data_t *pgdat)
3428{
3429#ifdef CONFIG_HIGHMEM
3430 enum zone_type zone_type;
3431
3432 for (zone_type = 0; zone_type <= ZONE_NORMAL; zone_type++) {
3433 struct zone *zone = &pgdat->node_zones[zone_type];
3434 if (zone->present_pages)
3435 node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY);
3436 }
3437#endif
3438}
3439
3436/** 3440/**
3437 * free_area_init_nodes - Initialise all pg_data_t and zone data 3441 * free_area_init_nodes - Initialise all pg_data_t and zone data
3438 * @max_zone_pfn: an array of max PFNs for each zone 3442 * @max_zone_pfn: an array of max PFNs for each zone
@@ -3507,6 +3511,11 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)
3507 pg_data_t *pgdat = NODE_DATA(nid); 3511 pg_data_t *pgdat = NODE_DATA(nid);
3508 free_area_init_node(nid, pgdat, NULL, 3512 free_area_init_node(nid, pgdat, NULL,
3509 find_min_pfn_for_node(nid), NULL); 3513 find_min_pfn_for_node(nid), NULL);
3514
3515 /* Any memory on that node */
3516 if (pgdat->node_present_pages)
3517 node_set_state(nid, N_HIGH_MEMORY);
3518 check_for_regular_memory(pgdat);
3510 } 3519 }
3511} 3520}
3512 3521
diff --git a/mm/shmem.c b/mm/shmem.c
index 131f2938f3ad..855b93b3637c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -971,7 +971,7 @@ static inline int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_
971 *nodelist++ = '\0'; 971 *nodelist++ = '\0';
972 if (nodelist_parse(nodelist, *policy_nodes)) 972 if (nodelist_parse(nodelist, *policy_nodes))
973 goto out; 973 goto out;
974 if (!nodes_subset(*policy_nodes, node_online_map)) 974 if (!nodes_subset(*policy_nodes, node_states[N_HIGH_MEMORY]))
975 goto out; 975 goto out;
976 } 976 }
977 if (!strcmp(value, "default")) { 977 if (!strcmp(value, "default")) {
@@ -996,9 +996,11 @@ static inline int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_
996 err = 0; 996 err = 0;
997 } else if (!strcmp(value, "interleave")) { 997 } else if (!strcmp(value, "interleave")) {
998 *policy = MPOL_INTERLEAVE; 998 *policy = MPOL_INTERLEAVE;
999 /* Default to nodes online if no nodelist */ 999 /*
1000 * Default to online nodes with memory if no nodelist
1001 */
1000 if (!nodelist) 1002 if (!nodelist)
1001 *policy_nodes = node_online_map; 1003 *policy_nodes = node_states[N_HIGH_MEMORY];
1002 err = 0; 1004 err = 0;
1003 } 1005 }
1004out: 1006out:
@@ -1060,7 +1062,8 @@ shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
1060 return page; 1062 return page;
1061} 1063}
1062#else 1064#else
1063static inline int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_nodes) 1065static inline int shmem_parse_mpol(char *value, int *policy,
1066 nodemask_t *policy_nodes)
1064{ 1067{
1065 return 1; 1068 return 1;
1066} 1069}
@@ -2238,7 +2241,7 @@ static int shmem_fill_super(struct super_block *sb,
2238 unsigned long blocks = 0; 2241 unsigned long blocks = 0;
2239 unsigned long inodes = 0; 2242 unsigned long inodes = 0;
2240 int policy = MPOL_DEFAULT; 2243 int policy = MPOL_DEFAULT;
2241 nodemask_t policy_nodes = node_online_map; 2244 nodemask_t policy_nodes = node_states[N_HIGH_MEMORY];
2242 2245
2243#ifdef CONFIG_TMPFS 2246#ifdef CONFIG_TMPFS
2244 /* 2247 /*