diff options
author | Tan Hu <[email protected]> | 2020-06-04 16:50:23 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2020-06-04 19:06:25 -0700 |
commit | 63d7f8167fe65891617d5eca6314eca46029955c (patch) | |
tree | 87b2857b0fb92fd6e7767e19af3f6bf5ec482cb0 | |
parent | a818e526cb4e5f8b06f4d648b88b269fbdd85bdd (diff) |
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: Tan Hu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Cc: <[email protected]>
Cc: Yi Wang <[email protected]>
Cc: <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | lib/flex_proportions.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 7852bfff50b1..451543937524 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -266,8 +266,7 @@ void __fprop_inc_percpu_max(struct fprop_global *p, if (numerator > (((u64)denominator) * max_frac) >> FPROP_FRAC_SHIFT) return; - } else - fprop_reflect_period_percpu(p, pl); - percpu_counter_add_batch(&pl->events, 1, PROP_BATCH); - percpu_counter_add(&p->events, 1); + } + + __fprop_inc_percpu(p, pl); } |