Skip to content

Commit

Permalink
SYSCTL: Add a mutex to the page_alloc zone order sysctl
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Andi Kleen committed Dec 23, 2009
1 parent 4440095 commit 443c6f1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
}


Expand Down

0 comments on commit 443c6f1

Please sign in to comment.