From patchwork Tue Jun 8 08:45:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Glitta X-Patchwork-Id: 12305891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D95C47082 for ; Tue, 8 Jun 2021 08:45:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8520661287 for ; Tue, 8 Jun 2021 08:45:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8520661287 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F03736B0070; Tue, 8 Jun 2021 04:45:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB32B6B0071; Tue, 8 Jun 2021 04:45:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D04E66B0072; Tue, 8 Jun 2021 04:45:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 95D246B0070 for ; Tue, 8 Jun 2021 04:45:21 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3BD1552CC for ; Tue, 8 Jun 2021 08:45:21 +0000 (UTC) X-FDA: 78229922442.40.B0FC24B Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf18.hostedemail.com (Postfix) with ESMTP id 78711200109D for ; Tue, 8 Jun 2021 08:45:18 +0000 (UTC) Received: by mail-ej1-f45.google.com with SMTP id g8so31350160ejx.1 for ; Tue, 08 Jun 2021 01:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fR3ab/zjle1Nt5uNzFnvgGqgsj2Kj0CI4fURhn3/mgg=; b=NDGy3qSGukY0MuCs9OFy7RAF3W3bLsQSZ25MzP+N8xFY2Jl+u1YT9C08Gdb1QlFVGr OE3R1gyCwf6EHTdXtEKMTS0jV5A2qQPNTJPwv3DyuA7fNpPmnAZDdVuXt0CJ1Bpx33V1 Wj7d+us7cCYIuq/SO41nQL+1QJHY5hPxLugL/iRHMweIiRjPgVZ5JEYtxVxJZKJBVl7w IgD0IKvjJiNgWEAmJthlvxrjmRJlFmvvdmLNqkvE3E+traDk6sFLoZd1P8unFM3jt7pY IJNgqyQ7XDF9gteqszgms8WFEpEXr/iZ+rVzv56jl+/OZGVqr88zmFLhL0b9vKNVgMEm bOOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fR3ab/zjle1Nt5uNzFnvgGqgsj2Kj0CI4fURhn3/mgg=; b=lazao3HVUcug14ksYpNk6Csnpgb9Rmbmd6AMskqA/F5CcW/Xc6wc8w9oi4cFo1aaqg 3MLt+aj7RKSKElBweAFnez1/p/o+7DPWDGOln3uXzfFYP5A/eBf6smaJP1DrCTR7Cdvj 4SV8vZh9aHSCE3uYhT/4/AaFyJFH6V8wpOmNJX4J2rJS0f6vC1fwJgviraOzHC1MJyi5 YfxFcRn2DQp7FfSwwnP4g1WagEAY71Z6l9IxfyItD6BusO6nXjcKzdzaZCqeCYsPOHSx OvmKPJ7u9NAKjHbo6TqAfsfebmuGzJSEHXhiOYMsyzBvQFGAkoNC9UwXQoQIbb3S4PaT Pecw== X-Gm-Message-State: AOAM533u6YG5advkFnDQBGDrczfaSHdBau0noBTUtw5kMRgbDE3oZlUG +LX0WMixMO6sGfhBw2Q+/VE= X-Google-Smtp-Source: ABdhPJzcPlCByzHE+0eTX3kyRDawZVkCCk1Q5edkuoHkkm9Qe22jfhGQl7cWRkva+y8IT7FyLd7MGA== X-Received: by 2002:a17:907:2bf9:: with SMTP id gv57mr22369726ejc.189.1623141919565; Tue, 08 Jun 2021 01:45:19 -0700 (PDT) Received: from localhost.localdomain (ispc-static-34.84-47-111.telekom.sk. [84.47.111.34]) by smtp.gmail.com with ESMTPSA id m4sm7353184eje.8.2021.06.08.01.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 01:45:19 -0700 (PDT) From: glittao@gmail.com To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, faiyazm@codeaurora.org, corbet@lwn.net, linux-doc@vger.kernel.org, Oliver Glitta Subject: [RFC 4/4] docs: add description of debugfs files for SLUB cache Date: Tue, 8 Jun 2021 10:45:17 +0200 Message-Id: <20210608084517.6119-1-glittao@gmail.com> X-Mailer: git-send-email 2.31.1.272.g89b43f80a5 In-Reply-To: <20210521121127.24653-1-glittao@gmail.com> References: <20210521121127.24653-1-glittao@gmail.com> MIME-Version: 1.0 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NDGy3qSG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of glittao@gmail.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=glittao@gmail.com X-Stat-Signature: yjpmszrh78arcypqfq5f3mfwwiow9uyn X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 78711200109D X-HE-Tag: 1623141918-838741 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: Oliver Glitta Add description of debugfs files alloc_traces, free_traces and all_objects to SLUB cache documentation. Signed-off-by: Oliver Glitta Acked-by: David Rientjes --- Documentation/vm/slub.rst | 109 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) -- 2.31.1.272.g89b43f80a5 diff --git a/Documentation/vm/slub.rst b/Documentation/vm/slub.rst index 03f294a638bd..2280d74d395c 100644 --- a/Documentation/vm/slub.rst +++ b/Documentation/vm/slub.rst @@ -384,5 +384,114 @@ c) Execute ``slabinfo-gnuplot.sh`` in '-t' mode, passing all of the 40,60`` range will plot only samples collected between 40th and 60th seconds). + +DebugFS files for SLUB +====================== + +For more debug information about current state of SLUB caches +with the user tracking debug option enabled, debugfs files +are available. There are 3 types of these files +with different debug information: + +1. alloc_traces:: + + Prints information about unique allocation traces of + the currently allocated objects together with their frequency. + Output sorted by frequency of use. + + Information on output: + Number of uses, allocating function, minimal/average/maximal jiffies since alloc, + pid of the process, allocated by cpu and stack trace. + + Example::: + + 1085 populate_error_injection_list+0x97/0x110 age=166678/166680/166682 pid=1 cpus=1:: + __slab_alloc+0x6d/0x90 + kmem_cache_alloc_trace+0x2eb/0x300 + populate_error_injection_list+0x97/0x110 + init_error_injection+0x1b/0x71 + do_one_initcall+0x5f/0x2d0 + kernel_init_freeable+0x26f/0x2d7 + kernel_init+0xe/0x118 + ret_from_fork+0x22/0x30 + + +2. free_traces:: + + Prints information about unique free traces of + the currently free objects together with their frequency. + Output sorted by frequency of use. + + Information on output: + Number of uses, freeing function, minimal/average/maximal jiffies since free, + pid of the process, freed by cpu and stack trace. + + Example::: + + 51 acpi_ut_update_ref_count+0x6a6/0x782 age=236886/237027/237772 pid=1 cpus=1 + kfree+0x2db/0x420 + acpi_ut_update_ref_count+0x6a6/0x782 + acpi_ut_update_object_reference+0x1ad/0x234 + acpi_ut_remove_reference+0x7d/0x84 + acpi_rs_get_prt_method_data+0x97/0xd6 + acpi_get_irq_routing_table+0x82/0xc4 + acpi_pci_irq_find_prt_entry+0x8e/0x2e0 + acpi_pci_irq_lookup+0x3a/0x1e0 + acpi_pci_irq_enable+0x77/0x240 + pcibios_enable_device+0x39/0x40 + do_pci_enable_device.part.0+0x5d/0xe0 + pci_enable_device_flags+0xfc/0x120 + pci_enable_device+0x13/0x20 + virtio_pci_probe+0x9e/0x170 + local_pci_probe+0x48/0x80 + pci_device_probe+0x105/0x1c0 + + +3. all_objects:: + + Prints information about all object (both allocated and free) + in given SLUB cache. + + Example::: + + Object: 0000000042ee8b00 free + Last allocated: ima_queue_key+0x2f/0x1b0 age=247112 pid=1 cpu=1 + __slab_alloc+0x6d/0x90 + kmem_cache_alloc_trace+0x2eb/0x300 + ima_queue_key+0x2f/0x1b0 + ima_post_key_create_or_update+0x46/0x80 + key_create_or_update+0x383/0x5b0 + load_certificate_list+0x75/0xa0 + load_system_certificate_list+0x2f/0x31 + do_one_initcall+0x5f/0x2d0 + kernel_init_freeable+0x26f/0x2d7 + kernel_init+0xe/0x118 + ret_from_fork+0x22/0x30 + Last free: ima_process_queued_keys.part.0+0x84/0xf0 age=170962 pid=137 cpu=1 + kfree+0x2db/0x420 + ima_process_queued_keys.part.0+0x84/0xf0 + ima_keys_handler+0x57/0x60 + process_one_work+0x2a5/0x590 + worker_thread+0x52/0x3f0 + kthread+0x140/0x160 + ret_from_fork+0x22/0x30 + + Information on output: + + a) Object:
allocated/free + There is address of object and information whether object is + allocated or free. + + b) Last allocated:
age= pid= cpu= + + c) Alloc stacktrace + + d) Last free:
age= pid= cpu= + + e) Free stacktrace + + Christoph Lameter, May 30, 2007 Sergey Senozhatsky, October 23, 2015