[PATCH v2 2/6] arm64: perf: Implement correct cap_user_time

Peter Zijlstra peterz at infradead.org
Wed Jul 15 04:38:00 EDT 2020


On Wed, Jul 15, 2020 at 10:05:08AM +0800, Leo Yan wrote:

> [leoyan: Use quot/rem to convert cyc to ns to avoid overflow]

> +		quot = rd->epoch_cyc >> rd->shift;
> +		rem = rd->epoch_cyc & (((u64)1 << rd->shift) - 1);
> +		ns = quot * rd->mult + ((rem * rd->mult) >> rd->shift);
> +		userpg->time_zero -= ns;

I think we have mul_u64_u32_shr() for that.




More information about the linux-arm-kernel mailing list