Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1715924lqe; Mon, 8 Apr 2024 19:18:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+R1l5XlojNFQY5/oNWNEIXV4SJP6ziOUKpbhYuB73s+yUkSfDvgmTWVyNQ25SmhnA2UgdgfTD7ezOO0Pc9uPGzIDYrDnevMZmn18AXQ== X-Google-Smtp-Source: AGHT+IFirwLMlOhlr+fLXh2mon9xnXchaJGh97p/EN0CrYiwx1jAo8MB80rBRvRrhQFjoQ03aJ0f X-Received: by 2002:a05:622a:1303:b0:434:ae59:dc73 with SMTP id v3-20020a05622a130300b00434ae59dc73mr3700802qtk.57.1712629134469; Mon, 08 Apr 2024 19:18:54 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j18-20020ac85f92000000b0043143cd3c05si9821480qta.414.2024.04.08.19.18.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 19:18:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=WUrPzTga; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-136127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 26CB51C23D8A for ; Tue, 9 Apr 2024 02:18:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23F0B4F5EA; Tue, 9 Apr 2024 02:18:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="WUrPzTga" Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2104.outbound.protection.outlook.com [40.107.215.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A29024F1E2; Tue, 9 Apr 2024 02:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.104 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712629126; cv=fail; b=Zb3xx2fNiPxb3NDDL0Q8VCZq1LssLpIXojA+Lg61jzX+uRdXVqm7qupeS+RfrVB1RJspP4zASnE79Dw254NG5kIWz5681DRQ04rl8yMUrlYrSwAv08MYvfmB4v6Drdl6Tnk6/jNazzswRJ3y6pIDJHDwrRZWCEWqKcj2SkzisSA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712629126; c=relaxed/simple; bh=/akjc4y9ytdphyKCvW29tZbGc9YRjakTrr5W1rScfWU=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=jftv1yg5kDUhOF/4majLvnlQK2Flev/pV4+nwk8eQ4+naPviQXVSY/D9GZ1PUW8TEa8ZGNZ2mU8oOLxfA3M3OHzMmIcc+jpIAOTWtq37A1WAu9qffBWjAAafTJzVGDyMOMpO1kv8qisHWhxoTA/DAkmFuKc3gLqSnJ+eb3o8WEk= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=WUrPzTga; arc=fail smtp.client-ip=40.107.215.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g/1HpYijZv/mtcQPbeIJl7g18zQmPQp84rldJL6sl2KB9Q73+1QooTw9gbNbrMn2JlJ78o+IsMzGbjFHJp9K8ntW64xwIgXb+6pUiTQbxYMBS7LBcHI1xcUNEFIX00Bw1ywjZLMbLPBtiIR9h4UA+bhtqqryHu+2bjNsqw9sEOAoDe+bybiLCLiT/+Jd62TWyUXs8Xij12caXxsz3sdG8a483AIF6B+UbazCkPhATMJvcQGTEtT9ZsKYcNuxDl6aL/p5nbKUyRAVDhKRiFcgUn1x4OA+Cr/1XrOKiQUqUNTit3f3sJodNHSWaHs6cxXNqMAsPV99DXNTtFJ6/UtdEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hnmwn/8wQlF3HJ5yklbH3JetP5U6ZyryDt3eiJXh4BU=; b=UGAM4OcW8l2WpkFHNHa4bimXX3Ipe/5wFsyKSFKZlRFWjEW6hneqb+YB+VntOc4F9Ovgyr8DBPC6ogJm2T7ygtu6EL1b94Uyp1lgUptU8BSPZT+5byRKtpPqB8b5E83U6oDDplVoyzdTyxXmCRRVwwSKZ9JdsUNh+spK2ZZIv6PFLWoALDTW9mDXKjAgpC9iI/Z5d9nfdEBRs84BWG2H5ZVw4PeZU/RnxdC98xqjBWAGte0C1lvCy2/6qjfHOVgFr20Ypi+ezKdxlTm95O89/eqef+CpF+g4Nj6DvG1+8PEW6lNxdj8bqStQcuf10uD2bD1d09WfT5rzl9m+Aj0b5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hnmwn/8wQlF3HJ5yklbH3JetP5U6ZyryDt3eiJXh4BU=; b=WUrPzTgaL8OdAc+nrrXqsTs/HZaSAyHZLqxRyBoI6CfJMR43OX86ir18Vu5stkKZwRi8V8pvSqgIt/plt8wzW1gD0gbNvwoxyB5LrKKFmHImvV+AgdrCZUSwU+5us1hiu+C32WG22S3qN3l1uXzIEbvEH2Pp2WHAt3+XR3oxliGQqxnSYdQFzK71T/96yi9UU9/iW0dWYtmzw+KeIZU3NKO5rqoMNS1qH+pFh5ZzQChHxphwZe3quCog8/6GZkmEUIcvNmHoa0leEv9QDAzL4VYwKwI/AMr7TlcbR7HQ7+zmz27OrbNbfKeiXSlzzLMiC2cfPnNjHz5QnFua1H8K5g== Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by JH0PR06MB6677.apcprd06.prod.outlook.com (2603:1096:990:31::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Tue, 9 Apr 2024 02:18:41 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::ad3:f48a:aa04:e11a]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::ad3:f48a:aa04:e11a%7]) with mapi id 15.20.7409.042; Tue, 9 Apr 2024 02:18:41 +0000 From: Huan Yang To: Tejun Heo , Zefan Li , Johannes Weiner , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Huan Yang Subject: [PATCH] cgroup: make cgroups info more readable Date: Tue, 9 Apr 2024 10:18:26 +0800 Message-Id: <20240409021826.1171921-1-link@vivo.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2P153CA0007.APCP153.PROD.OUTLOOK.COM (2603:1096::17) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|JH0PR06MB6677:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zwxnDYPURwEeJeBFRXKasRvJT3ynweFe50alBkjLWj+PTKdcHP9uqQ/UAoXOlebOl10haBig3MWaFBGDjehLFRiHjP9REnXofuIXVeHzX4Mpzcn4yekhLLdNzscVwszc9BMy2vI/f4VrVYJhz2O30ZRBGW/QMnAMUGQyU5+DLrzZbQ15AMBScTlosjqZnt1VNxAER+jAoF2Zyh/ssT2O9OEv4+t6CGc6xmcTAtd2sLL4F0/fBJjMPIChZEiaEEb6apSQB8sEqP7+FOHsdNM69QlWcA6WnKijCgtlGfFgVkikj3y6DfNMe8Owh+M5zspb2ryHnkziPdYFpuvTDqiSmOCZSrOAUTGMzXPnVVr7wof84MepKX4EQVIRL4FeWbDBSoE+I0ADlt41UxRokM6I4IECL+fZyJU/MQet40KTuLguV268ZuazN3rHuPunp4EbZoJidiRuU0hrLSzioyM64yJ4XMCdm26Gd50LBR8RP/1lcnBPjuCIX/HtlqYmO7MM4Dm97RtbHZC5/NabNoWaJjoupQXXMiX9albV1uXMSyqVHennq+A/3ggAA+hy5i5F7/diU+zLXJ1ltMTbFsJr55yNGVnxZm3B4o9wi4qFCB609z8fYuDCuZcwD/69QKTC8++lTRe059BOwgLC1mxCRIN1hng3uiq0b/tgVUU4r6Ik8+57I+C7IDJRNIosfgv4DIi6wgAro180Gd7hCFmu9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(52116005)(1800799015)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Fjtw0NL2jyv/BEyj+iqDC1gDxxxP8f80CpE0unTGgnf2IxeCtEy4obxvJWHG?= =?us-ascii?Q?wpzJ8cS5W6d6l8Smknow8uX2V5lGu6liQ6qAv/4dE/WTuo9m4BqnxDJRBiPB?= =?us-ascii?Q?El+OJuV5wmNWi2GlJ3lFHNSejYTwnf7L1deXRONCdmPglMeEzRFzmU7WxBGI?= =?us-ascii?Q?TY6YWPFHp9tJcvXhMHC0eKNzQd5B0ND7uPAoStFwx0gOqa/rOdBLWdjhwR12?= =?us-ascii?Q?8oJGYHgy1xNmgoknrpDba/YYOuZK0ttmMNd4sERnpI5B/kLGFzurcn0X7zQn?= =?us-ascii?Q?Ox+QrvuMHc0m7KLKQkcDWy53EoicgCQOuZtKy9cVIgwCmds9cdT8mmPBtXCF?= =?us-ascii?Q?ZlYV2qvNr+iPDyH/Qd7zrfagLzrcjZ7Vp7cyVTRbjDi4oK41sHoEf+R/4VsJ?= =?us-ascii?Q?FMtwExrr/hMR+X069OQFftUKNip5oQqM+9B/W12xlzd4mpsr+/a2dzBU+NX/?= =?us-ascii?Q?XFe+sDmF2exVSZtCEN0hB3TEJpa6xgg7Kutue9DdiDlOGNecCBaIjHcPNJfU?= =?us-ascii?Q?Vr9g8riFxIzHsaSNEI8mAoYfWas9LqJt7LbTgNgr68Lua7Szml+dYHSVrGSX?= =?us-ascii?Q?+VjZ8+tHfru5k1gPDt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cANMyyMjDCymT8iKyf/ATdoiYi+jXfxqiB/Vs8poSMCIC5Hhhp1b1eX4tE?= =?us-ascii?Q?MNGGrqsBDvHyd/8HlUUPJiJwqiPeInhay7HJG9O4?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3e7db00-7045-4dba-ace3-08dc583b5f9b X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2024 02:18:41.2040 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r5pnZQo01KFrX8d25E2/XLNQxN0luL+C6G3wlxkWQmqQxtDnXRG0gKR/ttbo41EKw4lSdMxEP84xze6qlgllCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6677 The current cgroups output format is based on tabs, which may cause misalignment of output information. Using placeholder formatting can make the output information more readable. Signed-off-by: Huan Yang --- kernel/cgroup/cgroup-v1.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 520a11cb12f4..c082a78f4c22 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -669,15 +669,16 @@ int proc_cgroupstats_show(struct seq_file *m, void *v) struct cgroup_subsys *ss; int i; - seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\tenabled\n"); + seq_printf(m, "%16s %16s %16s %16s\n", "#subsys_name", "hierarchy", + "num_cgroups", "enabled"); /* * Grab the subsystems state racily. No need to add avenue to * cgroup_mutex contention. */ for_each_subsys(ss, i) - seq_printf(m, "%s\t%d\t%d\t%d\n", - ss->legacy_name, ss->root->hierarchy_id, + seq_printf(m, "%16s %16d %16d %16d\n", ss->legacy_name, + ss->root->hierarchy_id, atomic_read(&ss->root->nr_cgrps), cgroup_ssid_enabled(i)); -- 2.34.1