Skip to content
Commit ea1ed790 authored by Yu Liao's avatar Yu Liao
Browse files

arm64/mpam: Fix wrong seconds to jiffies conversion

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9SXQ8



--------------------------------

According to the comment:

  jiff = (sec) * (NSEC_PER_SEC / NSEC_PER_JIFFIE);
  jiff = ((sec) * ((NSEC_PER_SEC * SCALE)/ NSEC_PER_JIFFIE)) / SCALE;
  Then we make SCALE a power of two so:
  jiff = ((sec) * ((NSEC_PER_SEC << SCALE)/ NSEC_PER_JIFFIE)) >> SCALE;
  Now we define:
  #define SEC_CONV = ((NSEC_PER_SEC << SCALE)/ NSEC_PER_JIFFIE))
  jiff = (sec * SEC_CONV) >> SCALE;

Fix the incorrect seconds to jiffies conversion.

Fixes: 8d7469cd ("arm64/mpam: Integrate monitor data for Memory Bandwidth if cdp enabled")
Signed-off-by: default avatarYu Liao <liaoyu15@huawei.com>
parent 21c2773b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment