| .. | .. | 
|---|
| 51 | 51 |   *   simple as possible. | 
|---|
| 52 | 52 |   * Must be called with preemption disabled. | 
|---|
| 53 | 53 |   */ | 
|---|
| 54 |  | -static void __resctrl_sched_in(void)  | 
|---|
 | 54 | +static inline void __resctrl_sched_in(struct task_struct *tsk)  | 
|---|
| 55 | 55 |  { | 
|---|
| 56 | 56 |  	struct resctrl_pqr_state *state = this_cpu_ptr(&pqr_state); | 
|---|
| 57 | 57 |  	u32 closid = state->default_closid; | 
|---|
| 58 | 58 |  	u32 rmid = state->default_rmid; | 
|---|
 | 59 | +	u32 tmp;  | 
|---|
| 59 | 60 |   | 
|---|
| 60 | 61 |  	/* | 
|---|
| 61 | 62 |  	 * If this task has a closid/rmid assigned, use it. | 
|---|
| 62 | 63 |  	 * Else use the closid/rmid assigned to this cpu. | 
|---|
| 63 | 64 |  	 */ | 
|---|
| 64 | 65 |  	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;  | 
|---|
| 67 | 69 |  	} | 
|---|
| 68 | 70 |   | 
|---|
| 69 | 71 |  	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;  | 
|---|
| 72 | 75 |  	} | 
|---|
| 73 | 76 |   | 
|---|
| 74 | 77 |  	if (closid != state->cur_closid || rmid != state->cur_rmid) { | 
|---|
| .. | .. | 
|---|
| 78 | 81 |  	} | 
|---|
| 79 | 82 |  } | 
|---|
| 80 | 83 |   | 
|---|
| 81 |  | -static inline void resctrl_sched_in(void)  | 
|---|
 | 84 | +static inline void resctrl_sched_in(struct task_struct *tsk)  | 
|---|
| 82 | 85 |  { | 
|---|
| 83 | 86 |  	if (static_branch_likely(&rdt_enable_key)) | 
|---|
| 84 |  | -		__resctrl_sched_in();  | 
|---|
 | 87 | +		__resctrl_sched_in(tsk);  | 
|---|
| 85 | 88 |  } | 
|---|
| 86 | 89 |   | 
|---|
| 87 | 90 |  void resctrl_cpu_detect(struct cpuinfo_x86 *c); | 
|---|
| 88 | 91 |   | 
|---|
| 89 | 92 |  #else | 
|---|
| 90 | 93 |   | 
|---|
| 91 |  | -static inline void resctrl_sched_in(void) {}  | 
|---|
 | 94 | +static inline void resctrl_sched_in(struct task_struct *tsk) {}  | 
|---|
| 92 | 95 |  static inline void resctrl_cpu_detect(struct cpuinfo_x86 *c) {} | 
|---|
| 93 | 96 |   | 
|---|
| 94 | 97 |  #endif /* CONFIG_X86_CPU_RESCTRL */ | 
|---|