x86: Fix various typos in comments
[linux-2.6-microblaze.git] / arch / x86 / kernel / cpu / resctrl / rdtgroup.c
index 460f3e0..2392f9f 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * User interface for Resource Alloction in Resource Director Technology(RDT)
+ * User interface for Resource Allocation in Resource Director Technology(RDT)
  *
  * Copyright (C) 2016 Intel Corporation
  *
@@ -294,7 +294,7 @@ static int rdtgroup_cpus_show(struct kernfs_open_file *of,
 /*
  * This is safe against resctrl_sched_in() called from __switch_to()
  * because __switch_to() is executed with interrupts disabled. A local call
- * from update_closid_rmid() is proteced against __switch_to() because
+ * from update_closid_rmid() is protected against __switch_to() because
  * preemption is disabled.
  */
 static void update_cpu_closid_rmid(void *info)
@@ -563,11 +563,11 @@ static int __rdtgroup_move_task(struct task_struct *tsk,
         */
 
        if (rdtgrp->type == RDTCTRL_GROUP) {
-               tsk->closid = rdtgrp->closid;
-               tsk->rmid = rdtgrp->mon.rmid;
+               WRITE_ONCE(tsk->closid, rdtgrp->closid);
+               WRITE_ONCE(tsk->rmid, rdtgrp->mon.rmid);
        } else if (rdtgrp->type == RDTMON_GROUP) {
                if (rdtgrp->mon.parent->closid == tsk->closid) {
-                       tsk->rmid = rdtgrp->mon.rmid;
+                       WRITE_ONCE(tsk->rmid, rdtgrp->mon.rmid);
                } else {
                        rdt_last_cmd_puts("Can't move task to different control group\n");
                        return -EINVAL;
@@ -2310,22 +2310,18 @@ static void rdt_move_group_tasks(struct rdtgroup *from, struct rdtgroup *to,
        for_each_process_thread(p, t) {
                if (!from || is_closid_match(t, from) ||
                    is_rmid_match(t, from)) {
-                       t->closid = to->closid;
-                       t->rmid = to->mon.rmid;
+                       WRITE_ONCE(t->closid, to->closid);
+                       WRITE_ONCE(t->rmid, to->mon.rmid);
 
-#ifdef CONFIG_SMP
                        /*
-                        * This is safe on x86 w/o barriers as the ordering
-                        * of writing to task_cpu() and t->on_cpu is
-                        * reverse to the reading here. The detection is
-                        * inaccurate as tasks might move or schedule
-                        * before the smp function call takes place. In
-                        * such a case the function call is pointless, but
+                        * If the task is on a CPU, set the CPU in the mask.
+                        * The detection is inaccurate as tasks might move or
+                        * schedule before the smp function call takes place.
+                        * In such a case the function call is pointless, but
                         * there is no other side effect.
                         */
-                       if (mask && t->on_cpu)
+                       if (IS_ENABLED(CONFIG_SMP) && mask && task_curr(t))
                                cpumask_set_cpu(task_cpu(t), mask);
-#endif
                }
        }
        read_unlock(&tasklist_lock);