lkml.org 
[lkml]   [2020]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/pelt: use shift operation instead of division operation
On Mon, Feb 24, 2020 at 11:30:55AM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
>
> Use shift operation to calculate the periods instead of division,
> since shift operation is more efficient than division operation.
>
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> ---
> kernel/sched/pelt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
> index bd006b7..ac79f8e 100644
> --- a/kernel/sched/pelt.c
> +++ b/kernel/sched/pelt.c
> @@ -114,7 +114,7 @@ static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3)
> u64 periods;
>
> delta += sa->period_contrib;
> - periods = delta / 1024; /* A period is 1024us (~1ms) */
> + periods = delta >> 10; /* A period is 1024us (~1ms) */

Find me a compiler that stupid.

\
 
 \ /
  Last update: 2020-02-24 10:33    [W:0.056 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site