/* * This value can never be a valid CLOSID, and is used when mapping a * (closid, rmid) pair to an index and back. On x86 only the RMID is * needed. The index is a software defined value.
*/ #define X86_RESCTRL_EMPTY_CLOSID ((u32)~0)
/** * struct resctrl_pqr_state - State cache for the PQR MSR * @cur_rmid: The cached Resource Monitoring ID * @cur_closid: The cached Class Of Service ID * @default_rmid: The user assigned Resource Monitoring ID * @default_closid: The user assigned cached Class Of Service ID * * The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the * lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always * contains both parts, so we need to cache them. This also * stores the user configured per cpu CLOSID and RMID. * * The cache also helps to avoid pointless updates if the value does * not change.
*/ struct resctrl_pqr_state {
u32 cur_rmid;
u32 cur_closid;
u32 default_rmid;
u32 default_closid;
};
/* * __resctrl_sched_in() - Writes the task's CLOSid/RMID to IA32_PQR_MSR * * Following considerations are made so that this has minimal impact * on scheduler hot path: * - This will stay as no-op unless we are running on an Intel SKU * which supports resource control or monitoring and we enable by * mounting the resctrl file system. * - Caches the per cpu CLOSid/RMID values and does the MSR write only * when a task with a different CLOSid/RMID is scheduled in. * - We allocate RMIDs/CLOSids globally in order to keep this as * simple as possible. * Must be called with preemption disabled.
*/ staticinlinevoid __resctrl_sched_in(struct task_struct *tsk)
{ struct resctrl_pqr_state *state = this_cpu_ptr(&pqr_state);
u32 closid = READ_ONCE(state->default_closid);
u32 rmid = READ_ONCE(state->default_rmid);
u32 tmp;
/* * If this task has a closid/rmid assigned, use it. * Else use the closid/rmid assigned to this cpu.
*/ if (static_branch_likely(&rdt_alloc_enable_key)) {
tmp = READ_ONCE(tsk->closid); if (tmp)
closid = tmp;
}
if (static_branch_likely(&rdt_mon_enable_key)) {
tmp = READ_ONCE(tsk->rmid); if (tmp)
rmid = tmp;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.