Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198268
b: refs/heads/master
c: 4eaf3f6
h: refs/heads/master
v: v3
  • Loading branch information
Haicheng Li authored and Linus Torvalds committed May 25, 2010
1 parent 74a657b commit 9cd00bc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f522509c77a5dea8dc384b735314f03908a6415
refs/heads/master: 4eaf3f64397c3db3c5785eee508270d62a9fabd9
1 change: 1 addition & 0 deletions trunk/include/linux/mmzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ typedef struct pglist_data {

#include <linux/memory_hotplug.h>

extern struct mutex zonelists_mutex;
void get_zone_counts(unsigned long *active, unsigned long *inactive,
unsigned long *free);
void build_all_zonelists(void *data);
Expand Down
5 changes: 4 additions & 1 deletion trunk/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,11 @@ int __cpuinit cpu_up(unsigned int cpu)
return -ENOMEM;
}

if (pgdat->node_zonelists->_zonerefs->zone == NULL)
if (pgdat->node_zonelists->_zonerefs->zone == NULL) {
mutex_lock(&zonelists_mutex);
build_all_zonelists(NULL);
mutex_unlock(&zonelists_mutex);
}
#endif

cpu_maps_update_begin();
Expand Down
11 changes: 3 additions & 8 deletions trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,6 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
int nid;
int ret;
struct memory_notify arg;
/*
* mutex to protect zone->pageset when it's still shared
* in onlined_pages()
*/
static DEFINE_MUTEX(zone_pageset_mutex);

arg.start_pfn = pfn;
arg.nr_pages = nr_pages;
Expand All @@ -420,14 +415,14 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
* This means the page allocator ignores this zone.
* So, zonelist must be updated after online.
*/
mutex_lock(&zone_pageset_mutex);
mutex_lock(&zonelists_mutex);
if (!populated_zone(zone))
need_zonelists_rebuild = 1;

ret = walk_system_ram_range(pfn, nr_pages, &onlined_pages,
online_pages_range);
if (ret) {
mutex_unlock(&zone_pageset_mutex);
mutex_unlock(&zonelists_mutex);
printk(KERN_DEBUG "online_pages %lx at %lx failed\n",
nr_pages, pfn);
memory_notify(MEM_CANCEL_ONLINE, &arg);
Expand All @@ -441,7 +436,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
else
zone_pcp_update(zone);

mutex_unlock(&zone_pageset_mutex);
mutex_unlock(&zonelists_mutex);
setup_per_zone_wmarks();
calculate_zone_inactive_ratio(zone);
if (onlined_pages) {
Expand Down
15 changes: 14 additions & 1 deletion trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2571,8 +2571,11 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
strncpy((char*)table->data, saved_string,
NUMA_ZONELIST_ORDER_LEN);
user_zonelist_order = oldval;
} else if (oldval != user_zonelist_order)
} else if (oldval != user_zonelist_order) {
mutex_lock(&zonelists_mutex);
build_all_zonelists(NULL);
mutex_unlock(&zonelists_mutex);
}
}
out:
mutex_unlock(&zl_order_mutex);
Expand Down Expand Up @@ -2924,6 +2927,12 @@ static void setup_pageset(struct per_cpu_pageset *p, unsigned long batch);
static DEFINE_PER_CPU(struct per_cpu_pageset, boot_pageset);
static void setup_zone_pageset(struct zone *zone);

/*
* Global mutex to protect against size modification of zonelists
* as well as to serialize pageset setup for the new populated zone.
*/
DEFINE_MUTEX(zonelists_mutex);

/* return values int ....just for stop_machine() */
static __init_refok int __build_all_zonelists(void *data)
{
Expand Down Expand Up @@ -2967,6 +2976,10 @@ static __init_refok int __build_all_zonelists(void *data)
return 0;
}

/*
* Called with zonelists_mutex held always
* unless system_state == SYSTEM_BOOTING.
*/
void build_all_zonelists(void *data)
{
set_zonelist_order();
Expand Down

0 comments on commit 9cd00bc

Please sign in to comment.