提交 7c2729a0 编写于 作者: T Tang Yizhou 提交者: Yang Yingliang

share_pool: Turn the negative statistics into zeros

ascend inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI
CVE: NA

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

For the implementation of Linux, statistics of RSS has a maximum 64 pages
deviation (256KB) but the track of share pool are all precise. So the
calculation results may be negative and confuse people.

We decide to show zeros when the results are negative. It is still
imprecise, but maybe better.
Signed-off-by: NTang Yizhou <tangyizhou@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NKefeng  Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 bf13a682
...@@ -2788,9 +2788,14 @@ static int idr_proc_stat_cb(int id, void *p, void *data) ...@@ -2788,9 +2788,14 @@ static int idr_proc_stat_cb(int id, void *p, void *data)
file = get_mm_counter(mm, MM_FILEPAGES); file = get_mm_counter(mm, MM_FILEPAGES);
shmem = get_mm_counter(mm, MM_SHMEMPAGES); shmem = get_mm_counter(mm, MM_SHMEMPAGES);
total_rss = anon + file + shmem; total_rss = anon + file + shmem;
/*
* Statistics of RSS has a maximum 64 pages deviation (256KB).
* Please check_sync_rss_stat().
*/
non_sp_res = page2kb(total_rss) - sp_alloc_nsize; non_sp_res = page2kb(total_rss) - sp_alloc_nsize;
non_sp_res = non_sp_res < 0 ? 0 : non_sp_res;
non_sp_shm = page2kb(shmem) - sp_alloc_nsize; non_sp_shm = page2kb(shmem) - sp_alloc_nsize;
non_sp_shm = non_sp_shm < 0 ? 0 : non_sp_shm; /* to be investigated */ non_sp_shm = non_sp_shm < 0 ? 0 : non_sp_shm;
seq_printf(seq, "%-8d ", id); seq_printf(seq, "%-8d ", id);
if (spg_id == 0) if (spg_id == 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册