From patchwork Wed Mar 8 09:41:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 66133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp238363wrd; Wed, 8 Mar 2023 01:58:44 -0800 (PST) X-Google-Smtp-Source: AK7set+ApVLf7/Zp52ko9hH66XfSwhC2h7TQ51e3u06jn4d2x3PG4oulHtfq6eYBz9rL00msmGxj X-Received: by 2002:aa7:cf8f:0:b0:4aa:a390:bf4a with SMTP id z15-20020aa7cf8f000000b004aaa390bf4amr17861809edx.20.1678269524147; Wed, 08 Mar 2023 01:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678269524; cv=none; d=google.com; s=arc-20160816; b=uSzfNKUvmEw72AtpIfQv84kJXFmY2xc4YDyYIWpvm05TXP6+wAhO4FK1LQ1HBgJO5g Xt6pboyL1OPtYEz2mYAzgtyGjt/3e263yxXGouvy5UuzH0XwhfOJlQY45KRiGjanbsEs ZLJlgaN6frMsvjpo3Dgpsx+GL6mtsaLgB3Dhxg/Zt8qxuJeyUR/A2a8J/7NcD2HZb4YH CO5je4P4ogDkMsyIstKm04LszZvf5Yn1T7+g5cT+uljIu85IYl+36Botn2hBGLDehh9s lVHyWJ26UVoLsJKMo1QdyU2Nbn+xpIv5qNfTm+17adqUb7qEYJvoUVTC+kj3Z2UJ3PX0 2iAQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TCY97IgQdv+eVDd67Oi2qOqfRry5DWncVhqaOuA69eE=; b=YGVzxHkUhQioP7Aw/oMjo4SD3JgO6vZ25iJpNgMrBBasSJhkMRE1tG2hXbGBxogMDn RW+RLnG1WHF3z4ZFEWULI7RbOp5kt8O7fq74XuPeoQwXzSHniZI/ipmY9nFDR/WHpTsN JNXCMBQzyGzhlW2i5kzbUncWKnBjo9Uj0zQ0VMxdjB5YfPQkseP41M3yz7eGyE6c4rmB VCFG8T9myPY8fNRdu4duOksEYtkRsZLKEHixkmzCdyiinNrI9DRggMbdbuHCB3QcjcJw tiv7+w6gl0fWphJhGXDbNFmMd+qxt6IdvtGd1IrlLnWr++SByWJotEQ0khRBNqBQ1pCD U8Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a4zMp2Yn; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020aa7dad0000000b004bdf14718c0si16240278eds.99.2023.03.08.01.58.21; Wed, 08 Mar 2023 01:58:44 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=a4zMp2Yn; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbjCHJlt (ORCPT + 99 others); Wed, 8 Mar 2023 04:41:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbjCHJlh (ORCPT ); Wed, 8 Mar 2023 04:41:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E85CB3291 for ; Wed, 8 Mar 2023 01:41:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12714B81C17 for ; Wed, 8 Mar 2023 09:41:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E1ACC4339E; Wed, 8 Mar 2023 09:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678268488; bh=nxbvrZboLg9dZQ5/M7cVi+ZACd7kAmzqj1YWR08+kKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4zMp2Yn7HDfIOkHs2LHrjV9yaXYJYlXB/aKnJzLJ/PF5ZrlqK+R5tPO7fbFxNUxs IOg7AHUKv7exmJro4ZoTEYmbvSPOoqa73BwAI14TlGIR/CFSFZ+7ZTm1F0MbW4ELt4 6jMh8OZGtB42IpkD0kOZcf1Woaq6cEJMzUTm34te4vtlC80/UgPKBHW7wvG4rsoFI6 CQmqk2kwLGUSJ4nEjQYF3tw0ODzEx2YVylfv2/ajUcNhSCG99D43hWVU28PhQ7/TUw 8u+3ARAC6O8BItMDilZ/vzwy8gnulVEiyO5ZbkV8lD3YZSazdBAqfut4kR1L6muYwQ DRYHul/m47P0w== From: Mike Rapoport To: linux-mm@kvack.org Cc: Andrew Morton , Dave Hansen , Mike Rapoport , Peter Zijlstra , Rick Edgecombe , Song Liu , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, x86@kernel.org Subject: [RFC PATCH 2/5] mm/unmapped_alloc: add debugfs file similar to /proc/pagetypeinfo Date: Wed, 8 Mar 2023 11:41:03 +0200 Message-Id: <20230308094106.227365-3-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230308094106.227365-1-rppt@kernel.org> References: <20230308094106.227365-1-rppt@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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?1759793144653826563?= X-GMAIL-MSGID: =?utf-8?q?1759793144653826563?= From: "Mike Rapoport (IBM)" Present statistics about unmapped_alloc in debugfs Signed-off-by: Mike Rapoport (IBM) --- mm/unmapped-alloc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mm/unmapped-alloc.c b/mm/unmapped-alloc.c index fb2d54204a3c..f74640e9ce9f 100644 --- a/mm/unmapped-alloc.c +++ b/mm/unmapped-alloc.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -213,3 +214,37 @@ int unmapped_alloc_init(void) return 0; } + +static int unmapped_alloc_debug_show(struct seq_file *m, void *private) +{ + int order; + + seq_printf(m, "MAX_ORDER: %d\n", MAX_ORDER); + seq_putc(m, '\n'); + + seq_printf(m, "%-10s", "Order:"); + for (order = 0; order < MAX_ORDER; ++order) + seq_printf(m, "%5d ", order); + seq_putc(m, '\n'); + + seq_printf(m, "%-10s", "Free:"); + for (order = 0; order < MAX_ORDER; ++order) + seq_printf(m, "%5lu ", free_area[order].nr_free); + seq_putc(m, '\n'); + + seq_printf(m, "%-10s", "Cached:"); + for (order = 0; order < MAX_ORDER; ++order) + seq_printf(m, "%5lu ", free_area[order].nr_cached); + seq_putc(m, '\n'); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(unmapped_alloc_debug); + +static int __init unmapped_alloc_init_late(void) +{ + debugfs_create_file("unmapped_alloc", 0444, NULL, + NULL, &unmapped_alloc_debug_fops); + return 0; +} +late_initcall(unmapped_alloc_init_late);