hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/resctrl.h
....@@ -51,24 +51,27 @@
5151 * simple as possible.
5252 * Must be called with preemption disabled.
5353 */
54
-static void __resctrl_sched_in(void)
54
+static inline void __resctrl_sched_in(struct task_struct *tsk)
5555 {
5656 struct resctrl_pqr_state *state = this_cpu_ptr(&pqr_state);
5757 u32 closid = state->default_closid;
5858 u32 rmid = state->default_rmid;
59
+ u32 tmp;
5960
6061 /*
6162 * If this task has a closid/rmid assigned, use it.
6263 * Else use the closid/rmid assigned to this cpu.
6364 */
6465 if (static_branch_likely(&rdt_alloc_enable_key)) {
65
- if (current->closid)
66
- closid = current->closid;
66
+ tmp = READ_ONCE(tsk->closid);
67
+ if (tmp)
68
+ closid = tmp;
6769 }
6870
6971 if (static_branch_likely(&rdt_mon_enable_key)) {
70
- if (current->rmid)
71
- rmid = current->rmid;
72
+ tmp = READ_ONCE(tsk->rmid);
73
+ if (tmp)
74
+ rmid = tmp;
7275 }
7376
7477 if (closid != state->cur_closid || rmid != state->cur_rmid) {
....@@ -78,17 +81,17 @@
7881 }
7982 }
8083
81
-static inline void resctrl_sched_in(void)
84
+static inline void resctrl_sched_in(struct task_struct *tsk)
8285 {
8386 if (static_branch_likely(&rdt_enable_key))
84
- __resctrl_sched_in();
87
+ __resctrl_sched_in(tsk);
8588 }
8689
8790 void resctrl_cpu_detect(struct cpuinfo_x86 *c);
8891
8992 #else
9093
91
-static inline void resctrl_sched_in(void) {}
94
+static inline void resctrl_sched_in(struct task_struct *tsk) {}
9295 static inline void resctrl_cpu_detect(struct cpuinfo_x86 *c) {}
9396
9497 #endif /* CONFIG_X86_CPU_RESCTRL */