Unverified Commit 6aeb5759 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3528 Print rootfs and tmpfs files charged by memcg

Merge Pull Request from: @ci-robot 
 
PR sync from: Jinjiang Tu <tujinjiang@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/GJQIQ3ZLNXH55W6UTVX7IJN3LTNHOH2J/ 
Support to print rootfs files and tmpfs files that having pages charged
in given memory cgroup. The files infomations can be printed through
interface "memory.memfs_files_info" or printed when OOM is triggered.

Jinjiang Tu (1):
  fs: move {lock, unlock}_mount_hash to fs/mount.h

Liu Shixin (2):
  mm/memcg_memfs_info: show files that having pages charged in
    mem_cgroup
  config: enable CONFIG_MEMCG_MEMFS_INFO by default


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I8PWEP 
 
Link:https://gitee.com/openeuler/kernel/pulls/3528

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Reviewed-by: default avatarZucheng Zheng <zhengzucheng@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 4145e406 ed768566
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0+

================
Memcg Memfs Info
================

Overview
========

Support to print rootfs files and tmpfs files that having pages charged
in given memory cgroup. The files infomations can be printed through
interface "memory.memfs_files_info" or printed when OOM is triggered.

User control
============

1. /sys/kernel/mm/memcg_memfs_info/enable
-----------------------------------------

Boolean type. The default value is 0, set it to 1 to enable the feature.

2. /sys/kernel/mm/memcg_memfs_info/max_print_files_in_oom
---------------------------------------------------------

Unsigned long type. The default value is 500, indicating that the maximum of
files can be print to console when OOM is triggered.

3. /sys/kernel/mm/memcg_memfs_info/size_threshold
-------------------------------------------------

Unsigned long type. The default value is 0, indicating that the minimum size of
files that can be printed.

4. /sys/fs/cgroup/memory/<memory>/memory.memfs_files_info
---------------------------------------------------------

Outputs the files who use memory in this memory cgroup.

---
Liu Shixin, Jan 2022
+1 −0
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ CONFIG_PAGE_COUNTER=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
CONFIG_MEMCG=y
CONFIG_MEMCG_V1_RECLAIM=y
CONFIG_MEMCG_MEMFS_INFO=y
CONFIG_MEMCG_KMEM=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
+1 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ CONFIG_PAGE_COUNTER=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
CONFIG_MEMCG=y
CONFIG_MEMCG_V1_RECLAIM=y
CONFIG_MEMCG_MEMFS_INFO=y
CONFIG_MEMCG_KMEM=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
+10 −0
Original line number Diff line number Diff line
@@ -123,6 +123,16 @@ static inline void get_mnt_ns(struct mnt_namespace *ns)

extern seqlock_t mount_lock;

static inline void lock_mount_hash(void)
{
	write_seqlock(&mount_lock);
}

static inline void unlock_mount_hash(void)
{
	write_sequnlock(&mount_lock);
}

struct proc_mounts {
	struct mnt_namespace *ns;
	struct path root;
+0 −10
Original line number Diff line number Diff line
@@ -99,16 +99,6 @@ EXPORT_SYMBOL_GPL(fs_kobj);
 */
__cacheline_aligned_in_smp DEFINE_SEQLOCK(mount_lock);

static inline void lock_mount_hash(void)
{
	write_seqlock(&mount_lock);
}

static inline void unlock_mount_hash(void)
{
	write_sequnlock(&mount_lock);
}

static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *dentry)
{
	unsigned long tmp = ((unsigned long)mnt / L1_CACHE_BYTES);
Loading