From nobody Sun Feb 8 18:09:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC57DC77B73 for ; Tue, 6 Jun 2023 13:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238030AbjFFNIF (ORCPT ); Tue, 6 Jun 2023 09:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237896AbjFFNIA (ORCPT ); Tue, 6 Jun 2023 09:08:00 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D075C170A; Tue, 6 Jun 2023 06:07:28 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Qb9f76BC7zLpwx; Tue, 6 Jun 2023 21:03:59 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 6 Jun 2023 21:07:01 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH] cgroup-v1: tweak the output format of cgroupstats Date: Tue, 6 Jun 2023 21:06:49 +0800 Message-ID: <20230606130649.485821-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The output of /proc/cgroups is somewhat awful now. For example, it may look like below: subsys_name hierarchy num_cgroups enabled cpuset 7 95 1 ... perf_event 6 1 1 ... files 10 1 1 Tweak the output format of cgroup stats to make it look better. After patch applied, it will look like below: subsys_name hierarchy num_cgroups enabled cpuset 11 73 1 ... perf_event 10 1 1 ... files 7 1 1 Signed-off-by: Miaohe Lin --- kernel/cgroup/cgroup-v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index aeef06c465ef..916871babeea 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -677,7 +677,7 @@ int proc_cgroupstats_show(struct seq_file *m, void *v) */ =20 for_each_subsys(ss, i) - seq_printf(m, "%s\t%d\t%d\t%d\n", + seq_printf(m, "%-12s\t%-9d\t%-11d\t%-7d\n", ss->legacy_name, ss->root->hierarchy_id, atomic_read(&ss->root->nr_cgrps), cgroup_ssid_enabled(i)); --=20 2.27.0