linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lu Jialin <lujialin4@huawei.com>
To: Zefan Li <lizefan.x@bytedance.com>, Tejun Heo <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Shakeel Butt <shakeelb@google.com>,
	Muchun Song <songmuchun@bytedance.com>
Cc: Lu Jialin <lujialin4@huawei.com>,
	Xiu Jianfeng <xiujianfeng@huawei.com>, <cgroups@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: [RFC 0/2] Introduce cgroup.top interface
Date: Fri, 26 Aug 2022 09:15:01 +0800	[thread overview]
Message-ID: <20220826011503.103894-1-lujialin4@huawei.com> (raw)

Cgroup is used to organize and manage resource available processes.
Currently there are no handy tool for gathering reousrce usage
information for each and every child cgroups, makes it hard to detect
resource outage and debug resource issues.

To overcome this, we present the cgroup.top interface. Just like the
top command, user is able to easily gather resource usage information
, allowing user to detect and respond to resource outage in child
cgroups

Show case:
/ # mount -t cgroup2 none /sys/fs/cgroup
/ # cd /sys/fs/cgroup/
/sys/fs/cgroup # echo "+memory" > cgroup.subtree_control
/sys/fs/cgroup # mkdir test1
/sys/fs/cgroup # mkdir test2
/sys/fs/cgroup # mkdir test3
/sys/fs/cgroup # echo $$ > test2/cgroup.procs
/sys/fs/cgroup # cd /test
/test # ./memcg_malloc 512000 &
/test # ./memcg_malloc 512000 &
/test # ./memcg_malloc 512000 &
/test # cd /sys/fs/cgroup
/sys/fs/cgroup # echo $$ > test1/cgroup.procs
/sys/fs/cgroup # cd /test
/test # ./memcg_malloc 512000 &
/test # cd /sys/fs/cgroup
/sys/fs/cgroup # echo $$ > test3/cgroup.procs
/sys/fs/cgroup # cat cgroup.top
memory top:
name            usage           anon            file            kernel
test2           1974272         1671168         0               270336
test1           700416          569344          0               94208
test3           196608          86016           0               86016


Lu Jialin (1):
  memcg: Adapt cgroup.top into per-memcg

Xiu Jianfeng (1):
  cgroup: Introduce per-cgroup resource top show interface

 include/linux/cgroup-defs.h |  1 +
 kernel/cgroup/cgroup.c      | 20 +++++++++
 mm/memcontrol.c             | 87 +++++++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)

-- 
2.17.1



             reply	other threads:[~2022-08-26  1:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  1:15 Lu Jialin [this message]
2022-08-26  1:15 ` [RFC 1/2] cgroup: Introduce per-cgroup resource top show interface Lu Jialin
2022-08-26  1:15 ` [RFC 2/2] memcg: Adapt cgroup.top into per-memcg Lu Jialin
2022-08-26  7:38   ` Michal Hocko
2022-08-26  3:17 ` [RFC 0/2] Introduce cgroup.top interface Tejun Heo
2022-08-26  9:50   ` lujialin (A)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220826011503.103894-1-lujialin4@huawei.com \
    --to=lujialin4@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mhocko@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=tj@kernel.org \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox