io_uring: remove priority tw list optimisation
[linux-2.6-microblaze.git] / kernel / sysctl.c
index e52b6e3..35d0342 100644 (file)
@@ -446,14 +446,14 @@ static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
                if (*negp) {
                        if (*lvalp > (unsigned long) INT_MAX + 1)
                                return -EINVAL;
-                       *valp = -*lvalp;
+                       WRITE_ONCE(*valp, -*lvalp);
                } else {
                        if (*lvalp > (unsigned long) INT_MAX)
                                return -EINVAL;
-                       *valp = *lvalp;
+                       WRITE_ONCE(*valp, *lvalp);
                }
        } else {
-               int val = *valp;
+               int val = READ_ONCE(*valp);
                if (val < 0) {
                        *negp = true;
                        *lvalp = -(unsigned long)val;
@@ -472,9 +472,9 @@ static int do_proc_douintvec_conv(unsigned long *lvalp,
        if (write) {
                if (*lvalp > UINT_MAX)
                        return -EINVAL;
-               *valp = *lvalp;
+               WRITE_ONCE(*valp, *lvalp);
        } else {
-               unsigned int val = *valp;
+               unsigned int val = READ_ONCE(*valp);
                *lvalp = (unsigned long)val;
        }
        return 0;
@@ -857,7 +857,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
                if ((param->min && *param->min > tmp) ||
                    (param->max && *param->max < tmp))
                        return -EINVAL;
-               *valp = tmp;
+               WRITE_ONCE(*valp, tmp);
        }
 
        return 0;
@@ -923,7 +923,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long *lvalp,
                    (param->max && *param->max < tmp))
                        return -ERANGE;
 
-               *valp = tmp;
+               WRITE_ONCE(*valp, tmp);
        }
 
        return 0;
@@ -1007,13 +1007,13 @@ int proc_dou8vec_minmax(struct ctl_table *table, int write,
 
        tmp.maxlen = sizeof(val);
        tmp.data = &val;
-       val = *data;
+       val = READ_ONCE(*data);
        res = do_proc_douintvec(&tmp, write, buffer, lenp, ppos,
                                do_proc_douintvec_minmax_conv, &param);
        if (res)
                return res;
        if (write)
-               *data = val;
+               WRITE_ONCE(*data, val);
        return 0;
 }
 EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
@@ -1090,9 +1090,9 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table,
                                err = -EINVAL;
                                break;
                        }
-                       *i = val;
+                       WRITE_ONCE(*i, val);
                } else {
-                       val = convdiv * (*i) / convmul;
+                       val = convdiv * READ_ONCE(*i) / convmul;
                        if (!first)
                                proc_put_char(&buffer, &left, '\t');
                        proc_put_long(&buffer, &left, val, false);
@@ -1173,9 +1173,12 @@ static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
        if (write) {
                if (*lvalp > INT_MAX / HZ)
                        return 1;
-               *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
+               if (*negp)
+                       WRITE_ONCE(*valp, -*lvalp * HZ);
+               else
+                       WRITE_ONCE(*valp, *lvalp * HZ);
        } else {
-               int val = *valp;
+               int val = READ_ONCE(*valp);
                unsigned long lval;
                if (val < 0) {
                        *negp = true;
@@ -1221,9 +1224,9 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
 
                if (jif > INT_MAX)
                        return 1;
-               *valp = (int)jif;
+               WRITE_ONCE(*valp, (int)jif);
        } else {
-               int val = *valp;
+               int val = READ_ONCE(*valp);
                unsigned long lval;
                if (val < 0) {
                        *negp = true;
@@ -1291,8 +1294,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
  * @ppos: the current position in the file
  *
  * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
- * values from/to the user buffer, treated as an ASCII string. 
- * The values read are assumed to be in 1/1000 seconds, and 
+ * values from/to the user buffer, treated as an ASCII string.
+ * The values read are assumed to be in 1/1000 seconds, and
  * are converted into jiffies.
  *
  * Returns 0 on success.
@@ -2091,6 +2094,17 @@ static struct ctl_table vm_table[] = {
                .extra1         = SYSCTL_ZERO,
                .extra2         = SYSCTL_TWO_HUNDRED,
        },
+#ifdef CONFIG_NUMA
+       {
+               .procname       = "numa_stat",
+               .data           = &sysctl_vm_numa_stat,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = sysctl_vm_numa_stat_handler,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
+       },
+#endif
 #ifdef CONFIG_HUGETLB_PAGE
        {
                .procname       = "nr_hugepages",
@@ -2107,15 +2121,6 @@ static struct ctl_table vm_table[] = {
                .mode           = 0644,
                .proc_handler   = &hugetlb_mempolicy_sysctl_handler,
        },
-       {
-               .procname               = "numa_stat",
-               .data                   = &sysctl_vm_numa_stat,
-               .maxlen                 = sizeof(int),
-               .mode                   = 0644,
-               .proc_handler   = sysctl_vm_numa_stat_handler,
-               .extra1                 = SYSCTL_ZERO,
-               .extra2                 = SYSCTL_ONE,
-       },
 #endif
         {
                .procname       = "hugetlb_shm_group",