All of lore.kernel.org
 help / color / mirror / Atom feed
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 <glittao@gmail.com>
Subject: [RFC 4/4] docs: add description of debugfs files for SLUB cache
Date: Tue,  8 Jun 2021 10:45:17 +0200	[thread overview]
Message-ID: <20210608084517.6119-1-glittao@gmail.com> (raw)
In-Reply-To: <20210521121127.24653-1-glittao@gmail.com>

From: Oliver Glitta <glittao@gmail.com>

Add description of debugfs files alloc_traces, free_traces
and all_objects to SLUB cache documentation.

Signed-off-by: Oliver Glitta <glittao@gmail.com>
---
 Documentation/vm/slub.rst | 109 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)

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: <address> allocated/free
+       There is address of object and information whether object is
+       allocated or free.
+
+    b) Last allocated: <address os user> age=<jiffies since alloc> pid=<pid of
+       the process> cpu=<allocated by cpu>
+
+    c) Alloc stacktrace
+
+    d) Last free: <address of user> age=<jiffies since freed> pid=<pid of
+       the process> cpu=<freed by cpu>
+
+    e) Free stacktrace
+
+
 Christoph Lameter, May 30, 2007
 Sergey Senozhatsky, October 23, 2015
--
2.31.1.272.g89b43f80a5


  parent reply	other threads:[~2021-06-08  8:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 12:11 [RFC 1/3] mm/slub: aggregate objects in cache by stack trace glittao
2021-05-21 12:11 ` [RFC 2/3] mm/slub: sort objects in cache by frequency of " glittao
2021-05-26 14:06   ` Vlastimil Babka
2021-05-21 12:11 ` [RFC 3/3] mm/slub: add all_objects implementation in debugfs glittao
2021-05-26 14:26   ` Vlastimil Babka
2021-05-26 14:05 ` [RFC 1/3] mm/slub: aggregate objects in cache by stack trace Vlastimil Babka
2021-06-08  8:45 ` glittao [this message]
2021-06-14  0:08   ` [RFC 4/4] docs: add description of debugfs files for SLUB cache David Rientjes
2021-06-14  0:08     ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210608084517.6119-1-glittao@gmail.com \
    --to=glittao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=faiyazm@codeaurora.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.