drivers: perf: use bitmap_empty() where appropriate
Subsystems (4)
PATCH 1/1 drivers: perf: use bitmap_empty() where appropriate
bitmap_empty() is more verbose and efficient, as it stops traversing bitmaps as soon as the 1st set bit found.
Switch perf code to using bitmap_empty() where appropriate, and correspondingly use boolean types.
Signed-off-by Yury Norov (NVIDIA) <[email protected]>
--- drivers/perf/riscv_pmu_sbi.c | 2 +- drivers/perf/starfive_starlink_pmu.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/perf/riscv_pmu_sbi.c +1 -1
@@ -1244,7 +1244,7 @@ static int riscv_pm_pmu_notify(struct notifier_block *b, unsigned long cmd, { struct riscv_pmu *rvpmu = container_of(b, struct riscv_pmu, riscv_pm_nb);struct cpu_hw_events *cpuc =this_cpu_ptr (rvpmu->hw_events); -int enabled =bitmap_weight (cpuc->used_hw_ctrs,RISCV_MAX_COUNTERS ); +bool enabled = !bitmap_empty (cpuc->used_hw_ctrs,RISCV_MAX_COUNTERS );struct perf_event *event;int idx;
drivers/perf/starfive_starlink_pmu.c +1 -2
@@ -450,8 +450,7 @@ static int starlink_pmu_pm_notify(struct notifier_block *b, starlink_pmu_pm_nb);struct starlink_hw_events *hw_events =this_cpu_ptr (starlink_pmu->hw_events); -int enabled =bitmap_weight (hw_events->used_mask, -STARLINK_PMU_MAX_COUNTERS ); +bool enabled = !bitmap_empty (hw_events->used_mask,STARLINK_PMU_MAX_COUNTERS );struct perf_event *event;int idx;
Signature · 1 line
2.43.0
Quoted 8 lines · Yury Norov (NVIDIA)
bitmap_empty()is more verbose and efficient, as it stops traversing bitmaps as soon as the 1st set bit found.Switch perf code to using
bitmap_empty()where appropriate, and correspondingly use boolean types.[...]
Applied to will (for-next/perf), thanks!
[1/1] drivers: perf: use bitmap_empty() where appropriate
https://git.kernel.org/will/c/0c7c64146f70
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev