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: 13165510 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66214C6FD1F for ; Wed, 8 Mar 2023 09:41:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 763836B0078; Wed, 8 Mar 2023 04:41:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E812280001; Wed, 8 Mar 2023 04:41:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D7756B007D; Wed, 8 Mar 2023 04:41:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4D4006B0078 for ; Wed, 8 Mar 2023 04:41:33 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 10C93A0E9F for ; Wed, 8 Mar 2023 09:41:33 +0000 (UTC) X-FDA: 80545238466.10.CD127C2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf10.hostedemail.com (Postfix) with ESMTP id 53B84C0010 for ; Wed, 8 Mar 2023 09:41:31 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=a4zMp2Yn; spf=pass (imf10.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678268491; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TCY97IgQdv+eVDd67Oi2qOqfRry5DWncVhqaOuA69eE=; b=Qpw7+Vx2wEZDKpjwUY22T4jM4M1x4wIAhtMqG3DnHYBOZQpm4HPI6KKTLRqkgvaqA/lz6H bgYkr09Aei3DB9abel6zlwis33wiqd1aYc5sMhVO2cVM1cTUDMb1js8CS/Sq94v0is4m1C rw6XGtT2B1WObKaFQyRbCmlZoH6oFrs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=a4zMp2Yn; spf=pass (imf10.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678268491; a=rsa-sha256; cv=none; b=XvtdXoN8VjrB/NAECJ9olvaUd8Wb2jvm7gnXCjJ+QAw4frXxacPNKpq8dnQV3l//NeQOq8 l6PtzoXo5FxbHWeoBax30+eKnvbD67dh/oWxU/5tBwnGR//6gcdXynkArz81DAoAMkybDy XTKYcRURx+kSofxGkABtgG+RMwTW09Y= 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 1B2CAB81C10; 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-Rspamd-Queue-Id: 53B84C0010 X-Stat-Signature: gmrkxscxy9xmup85cfhho6gfd75o15oi X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1678268491-269996 X-HE-Meta: U2FsdGVkX19tQvjYSL/fLoUBZa44I5QV2LAKLIx2ZZg0ic9Cfoo9gLxSAoYhrjxh8CiLxvOFAg1ZwfdnUtAIS8LoncFHOtH8Dl+6esl8kV9NqHy5T4zq7q9jFyOcXojpW8ETk6bXKvFJtCkLNmpyTcRhPrlfCstDRjddd9b3nly9Jaqo0nqDmAZDdT8jveEuurnS2tGu4Msr6jHqM6ge/JzcEEwW/yHgcjzx+LAzwFVlnrFWr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zHPoskgWbXi1XgEAg/ZCpgvJdiTYv+0wKWaejVY5/gSlBcJa0t1ciPmpEXdGaa7gJ+hlR4drk0g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);