Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569365
| From | Anshuman Khandual <khandual@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [DEBUG 18/21] mm: Add debugfs interface to dump each node's zonelist information |
| Date | 2017-01-30 04:50 +0100 |
| Message-ID | <t5b8B-7pH-7@gated-at.bofh.it> (permalink) |
| References | <t5aYV-7mm-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Each individual node in the system has a ZONELIST_FALLBACK zonelist
and a ZONELIST_NOFALLBACK zonelist. These zonelists decide fallback
order of zones during memory allocations. Sometimes it helps to dump
these zonelists to see the priority order of various zones in them.
Particularly platforms which support memory hotplug into previously
non existing zones (at boot), this interface helps in visualizing
which all zonelists of the system at what priority level, the new
hot added memory ends up in. POWER is such a platform where all the
memory detected during boot time remains with ZONE_DMA for good but
then hot plug process can actually get new memory into ZONE_MOVABLE.
So having a way to get the snapshot of the zonelists on the system
after memory or node hot[un]plug is desirable. This change adds one
new debugfs interface (/sys/kernel/debug/zonelists) which will fetch
and dump this information.
Example zonelist information from a KVM guest with four NUMA nodes
on a POWER8 platform.
[NODE (0)]
ZONELIST_FALLBACK
(0) (Node 0) (DMA)
(1) (Node 1) (DMA)
(2) (Node 2) (DMA)
(3) (Node 3) (DMA)
ZONELIST_NOFALLBACK
(0) (Node 0) (DMA)
[NODE (1)]
ZONELIST_FALLBACK
(0) (Node 1) (DMA)
(1) (Node 2) (DMA)
(2) (Node 3) (DMA)
(3) (Node 0) (DMA)
ZONELIST_NOFALLBACK
(0) (Node 1) (DMA)
[NODE (2)]
ZONELIST_FALLBACK
(0) (Node 2) (DMA)
(1) (Node 3) (DMA)
(2) (Node 0) (DMA)
(3) (Node 1) (DMA)
ZONELIST_NOFALLBACK
(0) (Node 2) (DMA)
[NODE (3)]
ZONELIST_FALLBACK
(0) (Node 3) (DMA)
(1) (Node 0) (DMA)
(2) (Node 1) (DMA)
(3) (Node 2) (DMA)
ZONELIST_NOFALLBACK
(0) (Node 3) (DMA)
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
mm/memory.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/mm/memory.c b/mm/memory.c
index 6bf2b47..1099d35 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -64,6 +64,7 @@
#include <linux/debugfs.h>
#include <linux/userfaultfd_k.h>
#include <linux/dax.h>
+#include <linux/mmzone.h>
#include <asm/io.h>
#include <asm/mmu_context.h>
@@ -3153,6 +3154,68 @@ static int __init fault_around_debugfs(void)
pr_warn("Failed to create fault_around_bytes in debugfs");
return 0;
}
+
+#ifdef CONFIG_NUMA
+static void show_zonelist(struct seq_file *m, struct zonelist *zonelist)
+{
+ unsigned int i;
+
+ for (i = 0; zonelist->_zonerefs[i].zone; i++) {
+ seq_printf(m, "\t\t(%d) (Node %d) (%-7s 0x%pK)\n", i,
+ zonelist->_zonerefs[i].zone->zone_pgdat->node_id,
+ zone_names[zonelist->_zonerefs[i].zone_idx],
+ (void *) zonelist->_zonerefs[i].zone);
+ }
+}
+
+static int zonelists_show(struct seq_file *m, void *v)
+{
+ struct zonelist *zonelist;
+ unsigned int node;
+
+ for_each_online_node(node) {
+ zonelist = &(NODE_DATA(node)->
+ node_zonelists[ZONELIST_FALLBACK]);
+ seq_printf(m, "[NODE (%d)]\n", node);
+ seq_puts(m, "\tZONELIST_FALLBACK ");
+ seq_printf(m, "(0x%pK)\n", zonelist);
+ show_zonelist(m, zonelist);
+
+ zonelist = &(NODE_DATA(node)->
+ node_zonelists[ZONELIST_NOFALLBACK]);
+ seq_puts(m, "\tZONELIST_NOFALLBACK ");
+ seq_printf(m, "(0x%pK)\n", zonelist);
+ show_zonelist(m, zonelist);
+ }
+ return 0;
+}
+
+static int zonelists_open(struct inode *inode, struct file *filp)
+{
+ return single_open(filp, zonelists_show, NULL);
+}
+
+static const struct file_operations zonelists_fops = {
+ .open = zonelists_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static int __init zonelists_debugfs(void)
+{
+ void *ret;
+
+ ret = debugfs_create_file("zonelists", 0444, NULL, NULL,
+ &zonelists_fops);
+ if (!ret)
+ pr_warn("Failed to create zonelists in debugfs");
+ return 0;
+}
+
+late_initcall(zonelists_debugfs);
+#endif /* CONFIG_NUMA */
+
late_initcall(fault_around_debugfs);
#endif
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC V2 00/12] Define coherent device memory node Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:40 +0100
[RFC V2 05/12] cpuset: Add cpuset_inc() inside cpuset_init() Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:40 +0100
Re: [RFC V2 05/12] cpuset: Add cpuset_inc() inside cpuset_init() Dave Hansen <dave.hansen@intel.com> - 2017-01-30 19:20 +0100
[RFC V2 04/12] mm: Change mbind(MPOL_BIND) implementation for CDM nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:40 +0100
[DEBUG 16/21] mm: Enable CONFIG_MOVABLE_NODE on powerpc Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 18/21] mm: Add debugfs interface to dump each node's zonelist information Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 19/21] mm: Add migrate_virtual_range migration interface Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 17/21] mm: Export definition of 'zone_names' array through mmzone.h Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 15/21] powerpc/mm: Enable CONFIG_MOVABLE_NODE for PPC64 platform Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 21/21] selftests/powerpc: Add a script to perform random VMA migrations Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 14/21] powerpc/mm: Create numa nodes for hotplug memory Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 13/21] powerpc/mm: Identify coherent device memory nodes during platform init Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[DEBUG 20/21] drivers: Add two drivers for coherent device memory tests Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 04:50 +0100
[RFC V2 09/12] mm: Exclude CDM marked VMAs from auto NUMA Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 07:10 +0100
[RFC V2 12/12] mm: Tag VMA with VM_CDM flag explicitly during mbind(MPOL_BIND) Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 07:20 +0100
Re: [RFC V2 12/12] mm: Tag VMA with VM_CDM flag explicitly during mbind(MPOL_BIND) Dave Hansen <dave.hansen@intel.com> - 2017-01-30 19:00 +0100
[RFC V2 10/12] mm: Ignore madvise(MADV_MERGEABLE) request for VM_CDM marked VMAs Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 10:30 +0100
[RFC V2 11/12] mm: Tag VMA with VM_CDM flag during page fault Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-01-30 10:40 +0100
Re: [RFC V2 11/12] mm: Tag VMA with VM_CDM flag during page fault Dave Hansen <dave.hansen@intel.com> - 2017-01-30 19:00 +0100
csiph-web