提交 250a1f57 编写于 作者: Z Zhou Guanghui 提交者: Zhong Jinghua

mm/sharepool: Don't display sharepool statistics in the container

ascend inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6HRGK

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

The sharepool statistics record the sharepool memory information used
by all containers in the system. We do not expect to query the
sharepool memory information applied by processes in other containers
in the container.

Therefore, the sharepool statistics cannot be queried in the container
to solve this problem.
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
上级 3c4cb588
无相关合并请求
......@@ -4063,8 +4063,22 @@ void spg_overview_show(struct seq_file *seq)
pr_info("\n");
}
static bool should_show_statistics(void)
{
if (!capable(CAP_SYS_ADMIN))
return false;
if (task_active_pid_ns(current) != &init_pid_ns)
return false;
return true;
}
static int spa_stat_show(struct seq_file *seq, void *offset)
{
if (!should_show_statistics())
return -EPERM;
spg_overview_show(seq);
spa_overview_show(seq);
/* print the file header */
......@@ -4113,6 +4127,9 @@ static int proc_usage_by_group(int id, void *p, void *data)
static int proc_group_usage_show(struct seq_file *seq, void *offset)
{
if (!should_show_statistics())
return -EPERM;
spg_overview_show(seq);
spa_overview_show(seq);
......@@ -4140,6 +4157,9 @@ static int proc_usage_show(struct seq_file *seq, void *offset)
long sp_res, sp_res_nsize, non_sp_res, non_sp_shm;
struct sp_proc_stat *proc_stat;
if (!should_show_statistics())
return -EPERM;
seq_printf(seq, "%-8s %-16s %-9s %-9s %-9s %-10s %-10s %-8s\n",
"PID", "COMM", "SP_ALLOC", "SP_K2U", "SP_RES", "Non-SP_RES",
"Non-SP_Shm", "VIRT");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部