diff mbox series

[RFC,4/4] docs: add description of debugfs files for SLUB cache

Message ID 20210608084517.6119-1-glittao@gmail.com (mailing list archive)
State New
Headers show
Series [RFC,1/3] mm/slub: aggregate objects in cache by stack trace | expand

Commit Message

Oliver Glitta June 8, 2021, 8:45 a.m. UTC
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(+)

--
2.31.1.272.g89b43f80a5

Comments

David Rientjes June 14, 2021, 12:08 a.m. UTC | #1
On Tue, 8 Jun 2021, glittao@gmail.com wrote:

> 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>

This looks good to me, thanks Oliver.

Adding in Randy Dunlap as well for Documentation changes if he has a 
chance to take a look.

Acked-by: David Rientjes <rientjes@google.com>
diff mbox series

Patch

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