Commit 63d7f816 authored by Tan Hu's avatar Tan Hu Committed by Linus Torvalds

lib/flex_proportions.c: cleanup __fprop_inc_percpu_max

If the given type has fraction smaller than max_frac/FPROP_FRAC_BASE, the
code could be modified to call __fprop_inc_percpu() directly and easier to
understand.  After this patch, fprop_reflect_period_percpu() will be
called twice, and quicky return on pl->period == p->period test, so it
would not result to significant downside of performance.

Thanks for Jan's guidance.
Signed-off-by: default avatarTan Hu <tan.hu@zte.com.cn>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: <xue.zhihong@zte.com.cn>
Cc: Yi Wang <wang.yi59@zte.com.cn>
Cc: <wang.liang82@zte.com.cn>
Link: http://lkml.kernel.org/r/1589004753-27554-1-git-send-email-tan.hu@zte.com.cnSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a818e526
...@@ -266,8 +266,7 @@ void __fprop_inc_percpu_max(struct fprop_global *p, ...@@ -266,8 +266,7 @@ void __fprop_inc_percpu_max(struct fprop_global *p,
if (numerator > if (numerator >
(((u64)denominator) * max_frac) >> FPROP_FRAC_SHIFT) (((u64)denominator) * max_frac) >> FPROP_FRAC_SHIFT)
return; return;
} else }
fprop_reflect_period_percpu(p, pl);
percpu_counter_add_batch(&pl->events, 1, PROP_BATCH); __fprop_inc_percpu(p, pl);
percpu_counter_add(&p->events, 1);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment