time: Fix accumulation bug triggered by long delay.
[safe/jmp/linux-2.6] / kernel / sysctl.c
index b4a5763..8a68b24 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/sysrq.h>
 #include <linux/highuid.h>
 #include <linux/writeback.h>
+#include <linux/ratelimit.h>
 #include <linux/hugetlb.h>
 #include <linux/initrd.h>
 #include <linux/key.h>
@@ -156,6 +157,8 @@ extern int no_unaligned_warning;
 extern int unaligned_dump_stack;
 #endif
 
+extern struct ratelimit_state printk_ratelimit_state;
+
 #ifdef CONFIG_RT_MUTEXES
 extern int max_lock_depth;
 #endif
@@ -241,6 +244,10 @@ static int min_sched_granularity_ns = 100000;              /* 100 usecs */
 static int max_sched_granularity_ns = NSEC_PER_SEC;    /* 1 second */
 static int min_wakeup_granularity_ns;                  /* 0 usecs */
 static int max_wakeup_granularity_ns = NSEC_PER_SEC;   /* 1 second */
+static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
+static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
+static int min_sched_shares_ratelimit = 100000; /* 100 usec */
+static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
 #endif
 
 static struct ctl_table kern_table[] = {
@@ -249,7 +256,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_sched_child_runs_first,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #ifdef CONFIG_SCHED_DEBUG
        {
@@ -257,7 +264,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_sched_min_granularity,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &sched_nr_latency_handler,
+               .proc_handler   = sched_proc_update_handler,
                .extra1         = &min_sched_granularity_ns,
                .extra2         = &max_sched_granularity_ns,
        },
@@ -266,7 +273,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_sched_latency,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &sched_nr_latency_handler,
+               .proc_handler   = sched_proc_update_handler,
                .extra1         = &min_sched_granularity_ns,
                .extra2         = &max_sched_granularity_ns,
        },
@@ -275,7 +282,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_sched_wakeup_granularity,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = sched_proc_update_handler,
                .extra1         = &min_wakeup_granularity_ns,
                .extra2         = &max_wakeup_granularity_ns,
        },
@@ -284,50 +291,54 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_sched_shares_ratelimit,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = sched_proc_update_handler,
+               .extra1         = &min_sched_shares_ratelimit,
+               .extra2         = &max_sched_shares_ratelimit,
        },
        {
-               .procname       = "sched_shares_thresh",
-               .data           = &sysctl_sched_shares_thresh,
-               .maxlen         = sizeof(unsigned int),
+               .procname       = "sched_tunable_scaling",
+               .data           = &sysctl_sched_tunable_scaling,
+               .maxlen         = sizeof(enum sched_tunable_scaling),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
-               .extra1         = &zero,
+               .proc_handler   = sched_proc_update_handler,
+               .extra1         = &min_sched_tunable_scaling,
+               .extra2         = &max_sched_tunable_scaling,
        },
        {
-               .procname       = "sched_features",
-               .data           = &sysctl_sched_features,
+               .procname       = "sched_shares_thresh",
+               .data           = &sysctl_sched_shares_thresh,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
        },
        {
                .procname       = "sched_migration_cost",
                .data           = &sysctl_sched_migration_cost,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "sched_nr_migrate",
                .data           = &sysctl_sched_nr_migrate,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "sched_time_avg",
                .data           = &sysctl_sched_time_avg,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "timer_migration",
                .data           = &sysctl_timer_migration,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one,
        },
@@ -337,21 +348,21 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_sched_rt_period,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &sched_rt_handler,
+               .proc_handler   = sched_rt_handler,
        },
        {
                .procname       = "sched_rt_runtime_us",
                .data           = &sysctl_sched_rt_runtime,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &sched_rt_handler,
+               .proc_handler   = sched_rt_handler,
        },
        {
                .procname       = "sched_compat_yield",
                .data           = &sysctl_sched_compat_yield,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #ifdef CONFIG_PROVE_LOCKING
        {
@@ -359,7 +370,7 @@ static struct ctl_table kern_table[] = {
                .data           = &prove_locking,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_LOCK_STAT
@@ -368,7 +379,7 @@ static struct ctl_table kern_table[] = {
                .data           = &lock_stat,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
        {
@@ -376,35 +387,35 @@ static struct ctl_table kern_table[] = {
                .data           = &panic_timeout,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "core_uses_pid",
                .data           = &core_uses_pid,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "core_pattern",
                .data           = core_pattern,
                .maxlen         = CORENAME_MAX_SIZE,
                .mode           = 0644,
-               .proc_handler   = &proc_dostring,
+               .proc_handler   = proc_dostring,
        },
        {
                .procname       = "core_pipe_limit",
                .data           = &core_pipe_limit,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #ifdef CONFIG_PROC_SYSCTL
        {
                .procname       = "tainted",
                .maxlen         = sizeof(long),
                .mode           = 0644,
-               .proc_handler   = &proc_taint,
+               .proc_handler   = proc_taint,
        },
 #endif
 #ifdef CONFIG_LATENCYTOP
@@ -413,7 +424,7 @@ static struct ctl_table kern_table[] = {
                .data           = &latencytop_enabled,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -422,7 +433,7 @@ static struct ctl_table kern_table[] = {
                .data           = &real_root_dev,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
        {
@@ -430,7 +441,7 @@ static struct ctl_table kern_table[] = {
                .data           = &print_fatal_signals,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #ifdef CONFIG_SPARC
        {
@@ -438,21 +449,21 @@ static struct ctl_table kern_table[] = {
                .data           = reboot_command,
                .maxlen         = 256,
                .mode           = 0644,
-               .proc_handler   = &proc_dostring,
+               .proc_handler   = proc_dostring,
        },
        {
                .procname       = "stop-a",
                .data           = &stop_a_enabled,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "scons-poweroff",
                .data           = &scons_pwroff,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_SPARC64
@@ -461,7 +472,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_tsb_ratio,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef __hppa__
@@ -470,14 +481,14 @@ static struct ctl_table kern_table[] = {
                .data           = &pwrsw_enabled,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "unaligned-trap",
                .data           = &unaligned_enabled,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
        {
@@ -485,7 +496,7 @@ static struct ctl_table kern_table[] = {
                .data           = &C_A_D,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #ifdef CONFIG_FUNCTION_TRACER
        {
@@ -493,7 +504,7 @@ static struct ctl_table kern_table[] = {
                .data           = &ftrace_enabled,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &ftrace_enable_sysctl,
+               .proc_handler   = ftrace_enable_sysctl,
        },
 #endif
 #ifdef CONFIG_STACK_TRACER
@@ -502,7 +513,7 @@ static struct ctl_table kern_table[] = {
                .data           = &stack_tracer_enabled,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &stack_trace_sysctl,
+               .proc_handler   = stack_trace_sysctl,
        },
 #endif
 #ifdef CONFIG_TRACING
@@ -511,7 +522,7 @@ static struct ctl_table kern_table[] = {
                .data           = &ftrace_dump_on_oops,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_MODULES
@@ -520,7 +531,7 @@ static struct ctl_table kern_table[] = {
                .data           = &modprobe_path,
                .maxlen         = KMOD_PATH_LEN,
                .mode           = 0644,
-               .proc_handler   = &proc_dostring,
+               .proc_handler   = proc_dostring,
        },
        {
                .procname       = "modules_disabled",
@@ -528,7 +539,7 @@ static struct ctl_table kern_table[] = {
                .maxlen         = sizeof(int),
                .mode           = 0644,
                /* only handle a transition from default "0" to "1" */
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &one,
                .extra2         = &one,
        },
@@ -539,7 +550,7 @@ static struct ctl_table kern_table[] = {
                .data           = &uevent_helper,
                .maxlen         = UEVENT_HELPER_PATH_LEN,
                .mode           = 0644,
-               .proc_handler   = &proc_dostring,
+               .proc_handler   = proc_dostring,
        },
 #endif
 #ifdef CONFIG_CHR_DEV_SG
@@ -548,7 +559,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sg_big_buff,
                .maxlen         = sizeof (int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_BSD_PROCESS_ACCT
@@ -557,7 +568,7 @@ static struct ctl_table kern_table[] = {
                .data           = &acct_parm,
                .maxlen         = 3*sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_MAGIC_SYSRQ
@@ -566,7 +577,7 @@ static struct ctl_table kern_table[] = {
                .data           = &__sysrq_enabled,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_PROC_SYSCTL
@@ -575,7 +586,7 @@ static struct ctl_table kern_table[] = {
                .data           = NULL,
                .maxlen         = sizeof (int),
                .mode           = 0600,
-               .proc_handler   = &proc_do_cad_pid,
+               .proc_handler   = proc_do_cad_pid,
        },
 #endif
        {
@@ -583,7 +594,7 @@ static struct ctl_table kern_table[] = {
                .data           = &max_threads,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "random",
@@ -595,7 +606,7 @@ static struct ctl_table kern_table[] = {
                .data           = &overflowuid,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &minolduid,
                .extra2         = &maxolduid,
        },
@@ -604,7 +615,7 @@ static struct ctl_table kern_table[] = {
                .data           = &overflowgid,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &minolduid,
                .extra2         = &maxolduid,
        },
@@ -615,7 +626,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_ieee_emulation_warnings,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
        {
@@ -623,7 +634,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_userprocess_debug,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
        {
@@ -631,7 +642,7 @@ static struct ctl_table kern_table[] = {
                .data           = &pid_max,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &pid_max_min,
                .extra2         = &pid_max_max,
        },
@@ -640,7 +651,7 @@ static struct ctl_table kern_table[] = {
                .data           = &panic_on_oops,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #if defined CONFIG_PRINTK
        {
@@ -648,28 +659,28 @@ static struct ctl_table kern_table[] = {
                .data           = &console_loglevel,
                .maxlen         = 4*sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "printk_ratelimit",
                .data           = &printk_ratelimit_state.interval,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_jiffies,
+               .proc_handler   = proc_dointvec_jiffies,
        },
        {
                .procname       = "printk_ratelimit_burst",
                .data           = &printk_ratelimit_state.burst,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "printk_delay",
                .data           = &printk_delay_msec,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &ten_thousand,
        },
@@ -679,7 +690,7 @@ static struct ctl_table kern_table[] = {
                .data           = &ngroups_max,
                .maxlen         = sizeof (int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
        {
@@ -687,14 +698,14 @@ static struct ctl_table kern_table[] = {
                .data           = &unknown_nmi_panic,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "nmi_watchdog",
                .data           = &nmi_watchdog_enabled,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_nmi_enabled,
+               .proc_handler   = proc_nmi_enabled,
        },
 #endif
 #if defined(CONFIG_X86)
@@ -703,42 +714,42 @@ static struct ctl_table kern_table[] = {
                .data           = &panic_on_unrecovered_nmi,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "panic_on_io_nmi",
                .data           = &panic_on_io_nmi,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "bootloader_type",
                .data           = &bootloader_type,
                .maxlen         = sizeof (int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "bootloader_version",
                .data           = &bootloader_version,
                .maxlen         = sizeof (int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "kstack_depth_to_print",
                .data           = &kstack_depth_to_print,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "io_delay_type",
                .data           = &io_delay_type,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #if defined(CONFIG_MMU)
@@ -747,7 +758,7 @@ static struct ctl_table kern_table[] = {
                .data           = &randomize_va_space,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
@@ -756,7 +767,7 @@ static struct ctl_table kern_table[] = {
                .data           = &spin_retry,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #if    defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
@@ -765,7 +776,7 @@ static struct ctl_table kern_table[] = {
                .data           = &acpi_realmode_flags,
                .maxlen         = sizeof (unsigned long),
                .mode           = 0644,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = proc_doulongvec_minmax,
        },
 #endif
 #ifdef CONFIG_IA64
@@ -774,14 +785,14 @@ static struct ctl_table kern_table[] = {
                .data           = &no_unaligned_warning,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "unaligned-dump-stack",
                .data           = &unaligned_dump_stack,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_DETECT_SOFTLOCKUP
@@ -790,7 +801,7 @@ static struct ctl_table kern_table[] = {
                .data           = &softlockup_panic,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one,
        },
@@ -799,7 +810,7 @@ static struct ctl_table kern_table[] = {
                .data           = &softlockup_thresh,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dosoftlockup_thresh,
+               .proc_handler   = proc_dosoftlockup_thresh,
                .extra1         = &neg_one,
                .extra2         = &sixty,
        },
@@ -810,7 +821,7 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_hung_task_panic,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one,
        },
@@ -819,21 +830,21 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_hung_task_check_count,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = proc_doulongvec_minmax,
        },
        {
                .procname       = "hung_task_timeout_secs",
                .data           = &sysctl_hung_task_timeout_secs,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &proc_dohung_task_timeout_secs,
+               .proc_handler   = proc_dohung_task_timeout_secs,
        },
        {
                .procname       = "hung_task_warnings",
                .data           = &sysctl_hung_task_warnings,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = proc_doulongvec_minmax,
        },
 #endif
 #ifdef CONFIG_COMPAT
@@ -842,7 +853,7 @@ static struct ctl_table kern_table[] = {
                .data           = &compat_log,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_RT_MUTEXES
@@ -851,7 +862,7 @@ static struct ctl_table kern_table[] = {
                .data           = &max_lock_depth,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
        {
@@ -859,7 +870,7 @@ static struct ctl_table kern_table[] = {
                .data           = &poweroff_cmd,
                .maxlen         = POWEROFF_CMD_PATH_LEN,
                .mode           = 0644,
-               .proc_handler   = &proc_dostring,
+               .proc_handler   = proc_dostring,
        },
 #ifdef CONFIG_KEYS
        {
@@ -874,7 +885,7 @@ static struct ctl_table kern_table[] = {
                .data           = &rcutorture_runnable,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_SLOW_WORK
@@ -890,21 +901,21 @@ static struct ctl_table kern_table[] = {
                .data           = &sysctl_perf_event_paranoid,
                .maxlen         = sizeof(sysctl_perf_event_paranoid),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "perf_event_mlock_kb",
                .data           = &sysctl_perf_event_mlock,
                .maxlen         = sizeof(sysctl_perf_event_mlock),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "perf_event_max_sample_rate",
                .data           = &sysctl_perf_event_sample_rate,
                .maxlen         = sizeof(sysctl_perf_event_sample_rate),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_KMEMCHECK
@@ -913,7 +924,7 @@ static struct ctl_table kern_table[] = {
                .data           = &kmemcheck_enabled,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_BLOCK
@@ -922,7 +933,7 @@ static struct ctl_table kern_table[] = {
                .data           = &blk_iopoll_enabled,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 /*
@@ -938,49 +949,49 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_overcommit_memory,
                .maxlen         = sizeof(sysctl_overcommit_memory),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "panic_on_oom",
                .data           = &sysctl_panic_on_oom,
                .maxlen         = sizeof(sysctl_panic_on_oom),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "oom_kill_allocating_task",
                .data           = &sysctl_oom_kill_allocating_task,
                .maxlen         = sizeof(sysctl_oom_kill_allocating_task),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "oom_dump_tasks",
                .data           = &sysctl_oom_dump_tasks,
                .maxlen         = sizeof(sysctl_oom_dump_tasks),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "overcommit_ratio",
                .data           = &sysctl_overcommit_ratio,
                .maxlen         = sizeof(sysctl_overcommit_ratio),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "page-cluster", 
                .data           = &page_cluster,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "dirty_background_ratio",
                .data           = &dirty_background_ratio,
                .maxlen         = sizeof(dirty_background_ratio),
                .mode           = 0644,
-               .proc_handler   = &dirty_background_ratio_handler,
+               .proc_handler   = dirty_background_ratio_handler,
                .extra1         = &zero,
                .extra2         = &one_hundred,
        },
@@ -989,7 +1000,7 @@ static struct ctl_table vm_table[] = {
                .data           = &dirty_background_bytes,
                .maxlen         = sizeof(dirty_background_bytes),
                .mode           = 0644,
-               .proc_handler   = &dirty_background_bytes_handler,
+               .proc_handler   = dirty_background_bytes_handler,
                .extra1         = &one_ul,
        },
        {
@@ -997,7 +1008,7 @@ static struct ctl_table vm_table[] = {
                .data           = &vm_dirty_ratio,
                .maxlen         = sizeof(vm_dirty_ratio),
                .mode           = 0644,
-               .proc_handler   = &dirty_ratio_handler,
+               .proc_handler   = dirty_ratio_handler,
                .extra1         = &zero,
                .extra2         = &one_hundred,
        },
@@ -1006,7 +1017,7 @@ static struct ctl_table vm_table[] = {
                .data           = &vm_dirty_bytes,
                .maxlen         = sizeof(vm_dirty_bytes),
                .mode           = 0644,
-               .proc_handler   = &dirty_bytes_handler,
+               .proc_handler   = dirty_bytes_handler,
                .extra1         = &dirty_bytes_min,
        },
        {
@@ -1014,61 +1025,72 @@ static struct ctl_table vm_table[] = {
                .data           = &dirty_writeback_interval,
                .maxlen         = sizeof(dirty_writeback_interval),
                .mode           = 0644,
-               .proc_handler   = &dirty_writeback_centisecs_handler,
+               .proc_handler   = dirty_writeback_centisecs_handler,
        },
        {
                .procname       = "dirty_expire_centisecs",
                .data           = &dirty_expire_interval,
                .maxlen         = sizeof(dirty_expire_interval),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "nr_pdflush_threads",
                .data           = &nr_pdflush_threads,
                .maxlen         = sizeof nr_pdflush_threads,
                .mode           = 0444 /* read-only*/,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "swappiness",
                .data           = &vm_swappiness,
                .maxlen         = sizeof(vm_swappiness),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one_hundred,
        },
 #ifdef CONFIG_HUGETLB_PAGE
-        {
+       {
                .procname       = "nr_hugepages",
                .data           = NULL,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &hugetlb_sysctl_handler,
+               .proc_handler   = hugetlb_sysctl_handler,
                .extra1         = (void *)&hugetlb_zero,
                .extra2         = (void *)&hugetlb_infinity,
-        },
+       },
+#ifdef CONFIG_NUMA
+       {
+               .procname       = "nr_hugepages_mempolicy",
+               .data           = NULL,
+               .maxlen         = sizeof(unsigned long),
+               .mode           = 0644,
+               .proc_handler   = &hugetlb_mempolicy_sysctl_handler,
+               .extra1         = (void *)&hugetlb_zero,
+               .extra2         = (void *)&hugetlb_infinity,
+       },
+#endif
         {
                .procname       = "hugetlb_shm_group",
                .data           = &sysctl_hugetlb_shm_group,
                .maxlen         = sizeof(gid_t),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
         },
         {
                .procname       = "hugepages_treat_as_movable",
                .data           = &hugepages_treat_as_movable,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &hugetlb_treat_movable_handler,
+               .proc_handler   = hugetlb_treat_movable_handler,
        },
        {
                .procname       = "nr_overcommit_hugepages",
                .data           = NULL,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &hugetlb_overcommit_handler,
+               .proc_handler   = hugetlb_overcommit_handler,
                .extra1         = (void *)&hugetlb_zero,
                .extra2         = (void *)&hugetlb_infinity,
        },
@@ -1078,7 +1100,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_lowmem_reserve_ratio,
                .maxlen         = sizeof(sysctl_lowmem_reserve_ratio),
                .mode           = 0644,
-               .proc_handler   = &lowmem_reserve_ratio_sysctl_handler,
+               .proc_handler   = lowmem_reserve_ratio_sysctl_handler,
        },
        {
                .procname       = "drop_caches",
@@ -1092,7 +1114,7 @@ static struct ctl_table vm_table[] = {
                .data           = &min_free_kbytes,
                .maxlen         = sizeof(min_free_kbytes),
                .mode           = 0644,
-               .proc_handler   = &min_free_kbytes_sysctl_handler,
+               .proc_handler   = min_free_kbytes_sysctl_handler,
                .extra1         = &zero,
        },
        {
@@ -1100,7 +1122,7 @@ static struct ctl_table vm_table[] = {
                .data           = &percpu_pagelist_fraction,
                .maxlen         = sizeof(percpu_pagelist_fraction),
                .mode           = 0644,
-               .proc_handler   = &percpu_pagelist_fraction_sysctl_handler,
+               .proc_handler   = percpu_pagelist_fraction_sysctl_handler,
                .extra1         = &min_percpu_pagelist_fract,
        },
 #ifdef CONFIG_MMU
@@ -1109,7 +1131,8 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_max_map_count,
                .maxlen         = sizeof(sysctl_max_map_count),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
        },
 #else
        {
@@ -1117,7 +1140,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_nr_trim_pages,
                .maxlen         = sizeof(sysctl_nr_trim_pages),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
        },
 #endif
@@ -1126,14 +1149,14 @@ static struct ctl_table vm_table[] = {
                .data           = &laptop_mode,
                .maxlen         = sizeof(laptop_mode),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_jiffies,
+               .proc_handler   = proc_dointvec_jiffies,
        },
        {
                .procname       = "block_dump",
                .data           = &block_dump,
                .maxlen         = sizeof(block_dump),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
                .extra1         = &zero,
        },
        {
@@ -1141,7 +1164,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_vfs_cache_pressure,
                .maxlen         = sizeof(sysctl_vfs_cache_pressure),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
                .extra1         = &zero,
        },
 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
@@ -1150,7 +1173,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_legacy_va_layout,
                .maxlen         = sizeof(sysctl_legacy_va_layout),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
                .extra1         = &zero,
        },
 #endif
@@ -1160,7 +1183,7 @@ static struct ctl_table vm_table[] = {
                .data           = &zone_reclaim_mode,
                .maxlen         = sizeof(zone_reclaim_mode),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
                .extra1         = &zero,
        },
        {
@@ -1168,7 +1191,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_min_unmapped_ratio,
                .maxlen         = sizeof(sysctl_min_unmapped_ratio),
                .mode           = 0644,
-               .proc_handler   = &sysctl_min_unmapped_ratio_sysctl_handler,
+               .proc_handler   = sysctl_min_unmapped_ratio_sysctl_handler,
                .extra1         = &zero,
                .extra2         = &one_hundred,
        },
@@ -1177,7 +1200,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_min_slab_ratio,
                .maxlen         = sizeof(sysctl_min_slab_ratio),
                .mode           = 0644,
-               .proc_handler   = &sysctl_min_slab_ratio_sysctl_handler,
+               .proc_handler   = sysctl_min_slab_ratio_sysctl_handler,
                .extra1         = &zero,
                .extra2         = &one_hundred,
        },
@@ -1188,23 +1211,25 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_stat_interval,
                .maxlen         = sizeof(sysctl_stat_interval),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_jiffies,
+               .proc_handler   = proc_dointvec_jiffies,
        },
 #endif
+#ifdef CONFIG_MMU
        {
                .procname       = "mmap_min_addr",
                .data           = &dac_mmap_min_addr,
                .maxlen         = sizeof(unsigned long),
                .mode           = 0644,
-               .proc_handler   = &mmap_min_addr_handler,
+               .proc_handler   = mmap_min_addr_handler,
        },
+#endif
 #ifdef CONFIG_NUMA
        {
                .procname       = "numa_zonelist_order",
                .data           = &numa_zonelist_order,
                .maxlen         = NUMA_ZONELIST_ORDER_LEN,
                .mode           = 0644,
-               .proc_handler   = &numa_zonelist_order_handler,
+               .proc_handler   = numa_zonelist_order_handler,
        },
 #endif
 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
@@ -1214,7 +1239,7 @@ static struct ctl_table vm_table[] = {
                .data           = &vdso_enabled,
                .maxlen         = sizeof(vdso_enabled),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
                .extra1         = &zero,
        },
 #endif
@@ -1224,7 +1249,7 @@ static struct ctl_table vm_table[] = {
                .data           = &vm_highmem_is_dirtyable,
                .maxlen         = sizeof(vm_highmem_is_dirtyable),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one,
        },
@@ -1234,7 +1259,7 @@ static struct ctl_table vm_table[] = {
                .data           = &scan_unevictable_pages,
                .maxlen         = sizeof(scan_unevictable_pages),
                .mode           = 0644,
-               .proc_handler   = &scan_unevictable_handler,
+               .proc_handler   = scan_unevictable_handler,
        },
 #ifdef CONFIG_MEMORY_FAILURE
        {
@@ -1242,7 +1267,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_memory_failure_early_kill,
                .maxlen         = sizeof(sysctl_memory_failure_early_kill),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one,
        },
@@ -1251,7 +1276,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_memory_failure_recovery,
                .maxlen         = sizeof(sysctl_memory_failure_recovery),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &one,
        },
@@ -1276,35 +1301,35 @@ static struct ctl_table fs_table[] = {
                .data           = &inodes_stat,
                .maxlen         = 2*sizeof(int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "inode-state",
                .data           = &inodes_stat,
                .maxlen         = 7*sizeof(int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "file-nr",
                .data           = &files_stat,
                .maxlen         = 3*sizeof(int),
                .mode           = 0444,
-               .proc_handler   = &proc_nr_files,
+               .proc_handler   = proc_nr_files,
        },
        {
                .procname       = "file-max",
                .data           = &files_stat.max_files,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "nr_open",
                .data           = &sysctl_nr_open,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &sysctl_nr_open_min,
                .extra2         = &sysctl_nr_open_max,
        },
@@ -1313,14 +1338,14 @@ static struct ctl_table fs_table[] = {
                .data           = &dentry_stat,
                .maxlen         = 6*sizeof(int),
                .mode           = 0444,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {
                .procname       = "overflowuid",
                .data           = &fs_overflowuid,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &minolduid,
                .extra2         = &maxolduid,
        },
@@ -1329,7 +1354,7 @@ static struct ctl_table fs_table[] = {
                .data           = &fs_overflowgid,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &minolduid,
                .extra2         = &maxolduid,
        },
@@ -1339,7 +1364,7 @@ static struct ctl_table fs_table[] = {
                .data           = &leases_enable,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_DNOTIFY
@@ -1348,7 +1373,7 @@ static struct ctl_table fs_table[] = {
                .data           = &dir_notify_enable,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_MMU
@@ -1358,7 +1383,7 @@ static struct ctl_table fs_table[] = {
                .data           = &lease_break_time,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
 #endif
 #ifdef CONFIG_AIO
@@ -1367,14 +1392,14 @@ static struct ctl_table fs_table[] = {
                .data           = &aio_nr,
                .maxlen         = sizeof(aio_nr),
                .mode           = 0444,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = proc_doulongvec_minmax,
        },
        {
                .procname       = "aio-max-nr",
                .data           = &aio_max_nr,
                .maxlen         = sizeof(aio_max_nr),
                .mode           = 0644,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = proc_doulongvec_minmax,
        },
 #endif /* CONFIG_AIO */
 #ifdef CONFIG_INOTIFY_USER
@@ -1397,7 +1422,7 @@ static struct ctl_table fs_table[] = {
                .data           = &suid_dumpable,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &zero,
                .extra2         = &two,
        },