提交 3d5ca29d 编写于 作者: X Xu Yu

alinux: mm, memcg: optimize division operation with memsli counters

to #26424368

Specifically, replace `val / 1000000` with `val >> 20` to do the
optimization.

This also fixes the possible compiling error when building with
ARCH=i386, which reports undefined reference to `__udivdi3`.
Signed-off-by: NXu Yu <xuyu@linux.alibaba.com>
Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
上级 055ed63b
...@@ -4599,7 +4599,7 @@ static int memcg_lat_stat_show(struct seq_file *m, void *v) ...@@ -4599,7 +4599,7 @@ static int memcg_lat_stat_show(struct seq_file *m, void *v)
seq_printf(m, ">=1000ms: \t%llu\n", seq_printf(m, ">=1000ms: \t%llu\n",
memcg_lat_stat_gather(memcg, idx, MEM_LAT_1000_INF)); memcg_lat_stat_gather(memcg, idx, MEM_LAT_1000_INF));
seq_printf(m, "total(ms): \t%llu\n", seq_printf(m, "total(ms): \t%llu\n",
memcg_lat_stat_gather(memcg, idx, MEM_LAT_TOTAL) / 1000000); memcg_lat_stat_gather(memcg, idx, MEM_LAT_TOTAL) >> 20);
return 0; return 0;
} }
...@@ -4608,7 +4608,7 @@ static enum mem_lat_count_t get_mem_lat_count_idx(u64 duration) ...@@ -4608,7 +4608,7 @@ static enum mem_lat_count_t get_mem_lat_count_idx(u64 duration)
{ {
enum mem_lat_count_t idx; enum mem_lat_count_t idx;
duration = duration / 1000000; duration = duration >> 20;
if (duration < 1) if (duration < 1)
idx = MEM_LAT_0_1; idx = MEM_LAT_0_1;
else if (duration < 5) else if (duration < 5)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册