]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PM: EM: Slightly reduce em_check_capacity_update() overhead
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 27 Jan 2025 13:38:25 +0000 (14:38 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 18 Feb 2025 19:44:22 +0000 (20:44 +0100)
commita8e62726ac0dd7b610c87ba1a938a5a9091c34df
treeb9e89a0144f3097b1cf6869ae33d3ba3cd4459a7
parent5fad775d432c6c9158ea12e7e00d8922ef8d3dfc
PM: EM: Slightly reduce em_check_capacity_update() overhead

Every iteration of the loop over all possible CPUs in
em_check_capacity_update() causes get_cpu_device() to be called twice
for the same CPU, once indirectly via em_cpu_get() and once directly.

Get rid of the indirect get_cpu_device() call by moving the direct
invocation of it earlier and using em_pd_get() instead of em_cpu_get()
to get a pd pointer for the dev one returned by it.

This also exposes the fact that dev is needed to get a pd, so the code
becomes somewhat easier to follow after it.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/1925950.tdWV9SEqCh@rjwysocki.net
kernel/power/energy_model.c