mirror of
https://github.com/adulau/aha.git
synced 2024-12-26 10:46:11 +00:00
Merge branch 'sysctl' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6
* 'sysctl' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6: SYSCTL: Add a mutex to the page_alloc zone order sysctl SYSCTL: Print binary sysctl warnings (nearly) only once
This commit is contained in:
commit
0b5e2588d8
2 changed files with 37 additions and 5 deletions
|
@ -1417,6 +1417,35 @@ static void deprecated_sysctl_warning(const int *name, int nlen)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WARN_ONCE_HASH_BITS 8
|
||||||
|
#define WARN_ONCE_HASH_SIZE (1<<WARN_ONCE_HASH_BITS)
|
||||||
|
|
||||||
|
static DECLARE_BITMAP(warn_once_bitmap, WARN_ONCE_HASH_SIZE);
|
||||||
|
|
||||||
|
#define FNV32_OFFSET 2166136261U
|
||||||
|
#define FNV32_PRIME 0x01000193
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print each legacy sysctl (approximately) only once.
|
||||||
|
* To avoid making the tables non-const use a external
|
||||||
|
* hash-table instead.
|
||||||
|
* Worst case hash collision: 6, but very rarely.
|
||||||
|
* NOTE! We don't use the SMP-safe bit tests. We simply
|
||||||
|
* don't care enough.
|
||||||
|
*/
|
||||||
|
static void warn_on_bintable(const int *name, int nlen)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
u32 hash = FNV32_OFFSET;
|
||||||
|
|
||||||
|
for (i = 0; i < nlen; i++)
|
||||||
|
hash = (hash ^ name[i]) * FNV32_PRIME;
|
||||||
|
hash %= WARN_ONCE_HASH_SIZE;
|
||||||
|
if (__test_and_set_bit(hash, warn_once_bitmap))
|
||||||
|
return;
|
||||||
|
deprecated_sysctl_warning(name, nlen);
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t do_sysctl(int __user *args_name, int nlen,
|
static ssize_t do_sysctl(int __user *args_name, int nlen,
|
||||||
void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
|
void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
|
||||||
{
|
{
|
||||||
|
@ -1431,7 +1460,7 @@ static ssize_t do_sysctl(int __user *args_name, int nlen,
|
||||||
if (get_user(name[i], args_name + i))
|
if (get_user(name[i], args_name + i))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
deprecated_sysctl_warning(name, nlen);
|
warn_on_bintable(name, nlen);
|
||||||
|
|
||||||
return binary_sysctl(name, nlen, oldval, oldlen, newval, newlen);
|
return binary_sysctl(name, nlen, oldval, oldlen, newval, newlen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue