Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp81408rwe; Fri, 26 Aug 2022 00:45:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ittTXJlM7vY6VoWThYrV4tQdoiSI9pvOH2iKMOSaDnGPf6q6NuMJdqb5F3xlyNGA/BXCp X-Received: by 2002:a17:907:6e29:b0:73d:6894:e668 with SMTP id sd41-20020a1709076e2900b0073d6894e668mr4611086ejc.453.1661499924761; Fri, 26 Aug 2022 00:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661499924; cv=none; d=google.com; s=arc-20160816; b=S3UonAE9sQKR6uG3L8Qth9Zf6fB3HWs7m6pwGq3ajsrNO+M2b1siY0809iH7Lmz8UT aQ7+EpYu3UERnOAmpD6fdV0Urt/1F0ssQ+tLwCi/QERV7vE/y0vPwBBxDmVuuZw03MJU tXcwfWa3qHGU17khiwHhT52wef9Ikpn9cyRjeB4aKeNU4R6300lQ9OuvmmshOotKWv6R wPCt/PcyEvj0kJ0kaa6rj5Rux7KCuhdFA/o74ySVRejqNyZfe32iiQWaLidjr8hK3roY 3t7JNodmZlh2NZX8PPa5qd4zIzet9byNxJ/yW98AdOcOZLE08r49oTA0kbU19Gp1jiJy sWSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RtYcNt5XkJRCJhjOhp/OsUYuN7jr0K2tW7LntfrhxP0=; b=M3WmAo25/bnpulK2qUdi6WfNKbE42NwktiYenEG0uEIclZ/IRzCN0REZi4zy9zP42b ZXha7bZYGyj6aRvnpuxjZ8JBPaXQMZa2UlH+5Fgx0wRh9kN2ZHgaBPe96WeoFzk1cUwR n0nrKn+fgqlfPrkGejj0TR8tQ8B9llI9u0aEf5LWDh4z6N2dy3njhjAzzKsMDJ/Y9XOA Qat20ckHRl2xa3b0sHwfW27PYkaLyE22o1/UxpAd8U9iSruQf6uiiy7a7+e9h/yvmkaz qQqikRIhfLj4WWkDlczhNpwM0M0mffLil9yGjU8yk+u6v//0ODomE7bCr3s9UlXJmF7K eT2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=I83xBB1b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs44-20020a1709072d2c00b0073d931b8e1dsi782614ejc.728.2022.08.26.00.44.58; Fri, 26 Aug 2022 00:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=I83xBB1b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245166AbiHZHiY (ORCPT + 99 others); Fri, 26 Aug 2022 03:38:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244859AbiHZHiW (ORCPT ); Fri, 26 Aug 2022 03:38:22 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 083C81E3E7; Fri, 26 Aug 2022 00:38:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B90F433687; Fri, 26 Aug 2022 07:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661499500; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RtYcNt5XkJRCJhjOhp/OsUYuN7jr0K2tW7LntfrhxP0=; b=I83xBB1b8caTVTsQfISvp8FIA6foX4NceUMAUYAmwPJBwHop0a0Gzweik2JXe457EyMmtN lSClOj6h8yDjeJxxWe7yi6oWSwq5m/lU52xMew9cIuPfHGqSESJsh2j1xWq98TMK759ova nDVuukr7lE2gmxo6ybIB1sxADXm6izM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9786513421; Fri, 26 Aug 2022 07:38:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id BYD3Imx4CGOxEQAAMHmgww (envelope-from ); Fri, 26 Aug 2022 07:38:20 +0000 Date: Fri, 26 Aug 2022 09:38:19 +0200 From: Michal Hocko To: Lu Jialin Cc: Zefan Li , Tejun Heo , Johannes Weiner , Andrew Morton , Roman Gushchin , Shakeel Butt , Muchun Song , Xiu Jianfeng , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC 2/2] memcg: Adapt cgroup.top into per-memcg Message-ID: References: <20220826011503.103894-1-lujialin4@huawei.com> <20220826011503.103894-3-lujialin4@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220826011503.103894-3-lujialin4@huawei.com> X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_RED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 26-08-22 09:15:03, Lu Jialin wrote: > cgroup.top is able to show resource usage information for each cgroups. > Currently only memory usage is monitored ,including usage,anon,file, > kmem(Bytes), stats for other resource types would be added as well. > > 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 This information is already present in memory.stat and can be easily post-processed to generate similar output. Why is that insufficient? -- Michal Hocko SUSE Labs