Skip to content

Commit f995801

Browse files
James Morsesuryasaimadhu
authored andcommitted
x86/resctrl: Use container_of() in delayed_work handlers
mbm_handle_overflow() and cqm_handle_limbo() are both provided with the domain's work_struct when called, but use get_domain_from_cpu() to find the domain, along with the appropriate error handling. container_of() saves some list walking and bitmap testing, use that instead. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lkml.kernel.org/r/20200708163929.2783-5-james.morse@arm.com
1 parent ae0fbed commit f995801

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎arch/x86/kernel/cpu/resctrl/monitor.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -477,19 +477,13 @@ void cqm_handle_limbo(struct work_struct *work)
477477
mutex_lock(&rdtgroup_mutex);
478478

479479
r = &rdt_resources_all[RDT_RESOURCE_L3];
480-
d = get_domain_from_cpu(cpu, r);
481-
482-
if (!d) {
483-
pr_warn_once("Failure to get domain for limbo worker\n");
484-
goto out_unlock;
485-
}
480+
d = container_of(work, struct rdt_domain, cqm_limbo.work);
486481

487482
__check_limbo(d, false);
488483

489484
if (has_busy_rmid(r, d))
490485
schedule_delayed_work_on(cpu, &d->cqm_limbo, delay);
491486

492-
out_unlock:
493487
mutex_unlock(&rdtgroup_mutex);
494488
}
495489

@@ -519,10 +513,7 @@ void mbm_handle_overflow(struct work_struct *work)
519513
goto out_unlock;
520514

521515
r = &rdt_resources_all[RDT_RESOURCE_L3];
522-
523-
d = get_domain_from_cpu(cpu, r);
524-
if (!d)
525-
goto out_unlock;
516+
d = container_of(work, struct rdt_domain, mbm_over.work);
526517

527518
list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
528519
mbm_update(r, d, prgrp->mon.rmid);

0 commit comments

Comments
 (0)