diff options
author | 2009-12-23 21:00:47 +0100 | |
---|---|---|
committer | 2009-12-23 21:01:16 +0100 | |
commit | 443c6f145de813518c36ac6b6e4e08d9445337e7 (patch) | |
tree | d0d635c07185b06ddcd2a82f6b2c90c188366431 /mm/page_alloc.c | |
parent | SYSCTL: Print binary sysctl warnings (nearly) only once (diff) | |
download | linux-443c6f145de813518c36ac6b6e4e08d9445337e7.tar.gz linux-443c6f145de813518c36ac6b6e4e08d9445337e7.tar.bz2 linux-443c6f145de813518c36ac6b6e4e08d9445337e7.zip |
SYSCTL: Add a mutex to the page_alloc zone order sysctl
The zone list code clearly cannot tolerate concurrent writers (I couldn't
find any locks for that), so simply add a global mutex. No need for RCU
in this case.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d79b92580561..4e9f5cc5fb59 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2402,13 +2402,14 @@ int numa_zonelist_order_handler(ctl_table *table, int write, { char saved_string[NUMA_ZONELIST_ORDER_LEN]; int ret; + static DEFINE_MUTEX(zl_order_mutex); + mutex_lock(&zl_order_mutex); if (write) - strncpy(saved_string, (char*)table->data, - NUMA_ZONELIST_ORDER_LEN); + strcpy(saved_string, (char*)table->data); ret = proc_dostring(table, write, buffer, length, ppos); if (ret) - return ret; + goto out; if (write) { int oldval = user_zonelist_order; if (__parse_numa_zonelist_order((char*)table->data)) { @@ -2421,7 +2422,9 @@ int numa_zonelist_order_handler(ctl_table *table, int write, } else if (oldval != user_zonelist_order) build_all_zonelists(); } - return 0; +out: + mutex_unlock(&zl_order_mutex); + return ret; } |