Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+37 -5
+30 -1
kernel/sysctl_binary.c
··· 1417 1417 return; 1418 1418 } 1419 1419 1420 + #define WARN_ONCE_HASH_BITS 8 1421 + #define WARN_ONCE_HASH_SIZE (1<<WARN_ONCE_HASH_BITS) 1422 + 1423 + static DECLARE_BITMAP(warn_once_bitmap, WARN_ONCE_HASH_SIZE); 1424 + 1425 + #define FNV32_OFFSET 2166136261U 1426 + #define FNV32_PRIME 0x01000193 1427 + 1428 + /* 1429 + * Print each legacy sysctl (approximately) only once. 1430 + * To avoid making the tables non-const use a external 1431 + * hash-table instead. 1432 + * Worst case hash collision: 6, but very rarely. 1433 + * NOTE! We don't use the SMP-safe bit tests. We simply 1434 + * don't care enough. 1435 + */ 1436 + static void warn_on_bintable(const int *name, int nlen) 1437 + { 1438 + int i; 1439 + u32 hash = FNV32_OFFSET; 1440 + 1441 + for (i = 0; i < nlen; i++) 1442 + hash = (hash ^ name[i]) * FNV32_PRIME; 1443 + hash %= WARN_ONCE_HASH_SIZE; 1444 + if (__test_and_set_bit(hash, warn_once_bitmap)) 1445 + return; 1446 + deprecated_sysctl_warning(name, nlen); 1447 + } 1448 + 1420 1449 static ssize_t do_sysctl(int __user *args_name, int nlen, 1421 1450 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) 1422 1451 { ··· 1460 1431 if (get_user(name[i], args_name + i)) 1461 1432 return -EFAULT; 1462 1433 1463 - deprecated_sysctl_warning(name, nlen); 1434 + warn_on_bintable(name, nlen); 1464 1435 1465 1436 return binary_sysctl(name, nlen, oldval, oldlen, newval, newlen); 1466 1437 }
+7 -4
mm/page_alloc.c
··· 2402 2402 { 2403 2403 char saved_string[NUMA_ZONELIST_ORDER_LEN]; 2404 2404 int ret; 2405 + static DEFINE_MUTEX(zl_order_mutex); 2405 2406 2407 + mutex_lock(&zl_order_mutex); 2406 2408 if (write) 2407 - strncpy(saved_string, (char*)table->data, 2408 - NUMA_ZONELIST_ORDER_LEN); 2409 + strcpy(saved_string, (char*)table->data); 2409 2410 ret = proc_dostring(table, write, buffer, length, ppos); 2410 2411 if (ret) 2411 - return ret; 2412 + goto out; 2412 2413 if (write) { 2413 2414 int oldval = user_zonelist_order; 2414 2415 if (__parse_numa_zonelist_order((char*)table->data)) { ··· 2422 2421 } else if (oldval != user_zonelist_order) 2423 2422 build_all_zonelists(); 2424 2423 } 2425 - return 0; 2424 + out: 2425 + mutex_unlock(&zl_order_mutex); 2426 + return ret; 2426 2427 } 2427 2428 2428 2429