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: 8d7469cd8d3e ("arm64/mpam: Integrate monitor data for Memory Bandwidth if cdp enabled") Signed-off-by: Yu Liao liaoyu15@huawei.com --- arch/arm64/kernel/mpam/mpam_resctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/mpam/mpam_resctrl.c b/arch/arm64/kernel/mpam/mpam_resctrl.c index dfbf1e056cc0..c5316b276d05 100644 --- a/arch/arm64/kernel/mpam/mpam_resctrl.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -467,7 +467,7 @@ static u64 cache_rdmon(struct rdt_domain *d, void *md_priv) * We should judge if return is OK, it is possible affected * by NRDY bit. */ - timeout = READ_ONCE(jiffies) + (1*SEC_CONVERSION); + timeout = READ_ONCE(jiffies) + msecs_to_jiffies(1000); do { if (time_after(READ_ONCE(jiffies), timeout)) { err = -ETIMEDOUT; @@ -508,7 +508,7 @@ static u64 mbw_rdmon(struct rdt_domain *d, void *md_priv) * We should judge if return is OK, it is possible affected * by NRDY bit. */ - timeout = READ_ONCE(jiffies) + (1*SEC_CONVERSION); + timeout = READ_ONCE(jiffies) + msecs_to_jiffies(1000); do { if (time_after(READ_ONCE(jiffies), timeout)) { err = -ETIMEDOUT;