Merge branch 'akpm' (patches from Andrew)
[sfrench/cifs-2.6.git] / kernel / sysctl.c
index ba4d9e85feb8ca69fb533049ab8a3a4a556bec9d..14f30b4a1b64c237a2fa32ce067559e9881faa84 100644 (file)
@@ -224,6 +224,11 @@ static int proc_dostring_coredump(struct ctl_table *table, int write,
 #endif
 static int proc_dopipe_max_size(struct ctl_table *table, int write,
                void __user *buffer, size_t *lenp, loff_t *ppos);
+#ifdef CONFIG_BPF_SYSCALL
+static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
+                                         void __user *buffer, size_t *lenp,
+                                         loff_t *ppos);
+#endif
 
 #ifdef CONFIG_MAGIC_SYSRQ
 /* Note: sysrq code uses its own private copy */
@@ -467,6 +472,17 @@ static struct ctl_table kern_table[] = {
                .extra1         = &one,
        },
 #endif
+#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
+       {
+               .procname       = "sched_energy_aware",
+               .data           = &sysctl_sched_energy_aware,
+               .maxlen         = sizeof(unsigned int),
+               .mode           = 0644,
+               .proc_handler   = sched_energy_aware_handler,
+               .extra1         = &zero,
+               .extra2         = &one,
+       },
+#endif
 #ifdef CONFIG_PROVE_LOCKING
        {
                .procname       = "prove_locking",
@@ -1229,6 +1245,15 @@ static struct ctl_table kern_table[] = {
                .extra1         = &one,
                .extra2         = &one,
        },
+       {
+               .procname       = "bpf_stats_enabled",
+               .data           = &sysctl_bpf_stats_enabled,
+               .maxlen         = sizeof(sysctl_bpf_stats_enabled),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax_bpf_stats,
+               .extra1         = &zero,
+               .extra2         = &one,
+       },
 #endif
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
        {
@@ -1446,7 +1471,7 @@ static struct ctl_table vm_table[] = {
                .data           = &sysctl_extfrag_threshold,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = sysctl_extfrag_handler,
+               .proc_handler   = proc_dointvec_minmax,
                .extra1         = &min_extfrag_threshold,
                .extra2         = &max_extfrag_threshold,
        },
@@ -3260,6 +3285,29 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
 
 #endif /* CONFIG_PROC_SYSCTL */
 
+#ifdef CONFIG_BPF_SYSCALL
+static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
+                                         void __user *buffer, size_t *lenp,
+                                         loff_t *ppos)
+{
+       int ret, bpf_stats = *(int *)table->data;
+       struct ctl_table tmp = *table;
+
+       if (write && !capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       tmp.data = &bpf_stats;
+       ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
+       if (write && !ret) {
+               *(int *)table->data = bpf_stats;
+               if (bpf_stats)
+                       static_branch_enable(&bpf_stats_enabled_key);
+               else
+                       static_branch_disable(&bpf_stats_enabled_key);
+       }
+       return ret;
+}
+#endif
 /*
  * No sense putting this after each symbol definition, twice,
  * exception granted :-)