提交 443c6f14 编写于 作者: A Andi Kleen

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: NAndi Kleen <ak@linux.intel.com>
上级 4440095c
...@@ -2402,13 +2402,14 @@ int numa_zonelist_order_handler(ctl_table *table, int write, ...@@ -2402,13 +2402,14 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
{ {
char saved_string[NUMA_ZONELIST_ORDER_LEN]; char saved_string[NUMA_ZONELIST_ORDER_LEN];
int ret; int ret;
static DEFINE_MUTEX(zl_order_mutex);
mutex_lock(&zl_order_mutex);
if (write) if (write)
strncpy(saved_string, (char*)table->data, strcpy(saved_string, (char*)table->data);
NUMA_ZONELIST_ORDER_LEN);
ret = proc_dostring(table, write, buffer, length, ppos); ret = proc_dostring(table, write, buffer, length, ppos);
if (ret) if (ret)
return ret; goto out;
if (write) { if (write) {
int oldval = user_zonelist_order; int oldval = user_zonelist_order;
if (__parse_numa_zonelist_order((char*)table->data)) { if (__parse_numa_zonelist_order((char*)table->data)) {
...@@ -2421,7 +2422,9 @@ int numa_zonelist_order_handler(ctl_table *table, int write, ...@@ -2421,7 +2422,9 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
} else if (oldval != user_zonelist_order) } else if (oldval != user_zonelist_order)
build_all_zonelists(); build_all_zonelists();
} }
return 0; out:
mutex_unlock(&zl_order_mutex);
return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册