From patchwork Tue Jun 6 13:06:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 103820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3395063vqr; Tue, 6 Jun 2023 06:29:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5shNVYNcqUJW3vfIVtVY0KbYys4dWrXsvVCqokJsQv3pLaIU5Rhihm0XEzyNM4RtCpKPsF X-Received: by 2002:a05:6a20:3943:b0:10a:be5c:6e3d with SMTP id r3-20020a056a20394300b0010abe5c6e3dmr10452335pzg.13.1686058145591; Tue, 06 Jun 2023 06:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686058145; cv=none; d=google.com; s=arc-20160816; b=lMscoAVZ/H+65xil/I5RLkpLjVX7HwBUyDcTn70vu8+F7fUy8TbQanuA/GObCYg8c/ R504PlqTK208Li5sZesE4rRJCCzbgjmcOQyz2AyHCfLzoMtaOov2RQvwpgnwWYCZ1Ndn jVuukcZ5lVvTwFxvFPirg5Drvec+GWU4nukMbFyDzsLn3vsRNv2otPsYJMMo2hZ8u31L ycWHTdMaAyh9IwTY7wctONTQe1FLejHMkO7n1FQPPOXt6tsf2yqG8VmurxKUxLaWjEy2 p24bl+fd339pYJGtyoiH3fZHolaNgeMg3EUjO7SB0QenwGSI6oP5SEi5vCh8qG81xThp E8iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=jy3STuA/2OEARh+K0k/zgWPG4/BK9E9VG4GpnKGqnAU=; b=CTAfyS0pCUCityx/V/Y2FfUJRCsYVbkSVdOGmIvOjN3dLM2EuNcgr8fqmD6DmKbDbu WBUzNeevTKK8lMlml1cowRHwSDFBl/rGLNB9qkZK0wwcb9/uvl3exl8jaHVkUHxBsA7V oU/ffms9DVxBdf9IoGeB65lGLT3dEZnTEkFi97RWmp8tKxMg0LnGrSz0XJdueBBTMbKn p72yJCJju2oK/OKmEJKtgoXzNySR7mSKqE1xMrzQjYXCoKLQMUd4rdRp4m1137bnZ5Vy IAnUdEP3i+IqkIpS97ASNEfmNJR3fZNYlKqLU3grPpm2Moy8OixgtXcY/QDXIa2kac+A kQjg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a637a53000000b005307b843a98si7328573pgn.53.2023.06.06.06.28.53; Tue, 06 Jun 2023 06:29:05 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238027AbjFFNIE (ORCPT + 99 others); Tue, 6 Jun 2023 09:08:04 -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 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767960105998115801?= X-GMAIL-MSGID: =?utf-8?q?1767960105998115801?= 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) */ 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));