Skip to content

Commit 6394f0e

Browse files
riteshharjanimaddy-kerneldev
authored andcommitted
powerpc/64s/pgtable: Enable directMap counters in meminfo for Hash
This patch enables the directMap counters to be printed in proc/meminfo for Hash mmu. With this patch on a system with 8G of DRAM we can see the entire RAM mapped with 16M pagesize: cat /proc/meminfo |grep -i direct DirectMap4k: 0 kB DirectMap64k: 0 kB DirectMap16M: 8388608 kB DirectMap16G: 0 kB Tested with devdax too: root@buildroot:/# ndctl create-namespace -r region0 -m devdax -s 2G { "dev":"namespace0.0", "mode":"devdax", "map":"dev", "size":"2032.00 MiB (2130.71 MB)", "uuid":"aa383ded-cd99-43a0-979f-5225467cfb40", "daxregion":{ "id":0, "size":"2032.00 MiB (2130.71 MB)", "align":16777216, "devices":[ { "chardev":"dax0.0", "size":"2032.00 MiB (2130.71 MB)", "target_node":0, "align":"16.00 MiB (16.78 MB)", "mode":"devdax" } ] }, "align":16777216 } root@buildroot:/# cat /proc/meminfo |grep -i direct DirectMap4k: 0 kB DirectMap64k: 0 kB DirectMap16M: 10485760 kB DirectMap16G: 0 kB root@buildroot:/# ndctl destroy-namespace -f all destroyed 1 namespace root@buildroot:/# cat /proc/meminfo |grep -i direct DirectMap4k: 0 kB DirectMap64k: 0 kB DirectMap16M: 8388608 kB DirectMap16G: 0 kB Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/ffe47912e17075649b6ce5b2ee5d7f3eb5352e0b.1761834163.git.ritesh.list@gmail.com
1 parent b296fda commit 6394f0e

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

arch/powerpc/mm/book3s64/pgtable.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -510,20 +510,21 @@ atomic_long_t direct_pages_count[MMU_PAGE_COUNT];
510510

511511
void arch_report_meminfo(struct seq_file *m)
512512
{
513-
/*
514-
* Hash maps the memory with one size mmu_linear_psize.
515-
* So don't bother to print these on hash
516-
*/
517-
if (!radix_enabled())
518-
return;
519513
seq_printf(m, "DirectMap4k: %8lu kB\n",
520514
atomic_long_read(&direct_pages_count[MMU_PAGE_4K]) << 2);
521-
seq_printf(m, "DirectMap64k: %8lu kB\n",
515+
seq_printf(m, "DirectMap64k: %8lu kB\n",
522516
atomic_long_read(&direct_pages_count[MMU_PAGE_64K]) << 6);
523-
seq_printf(m, "DirectMap2M: %8lu kB\n",
524-
atomic_long_read(&direct_pages_count[MMU_PAGE_2M]) << 11);
525-
seq_printf(m, "DirectMap1G: %8lu kB\n",
526-
atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20);
517+
if (radix_enabled()) {
518+
seq_printf(m, "DirectMap2M: %8lu kB\n",
519+
atomic_long_read(&direct_pages_count[MMU_PAGE_2M]) << 11);
520+
seq_printf(m, "DirectMap1G: %8lu kB\n",
521+
atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20);
522+
} else {
523+
seq_printf(m, "DirectMap16M: %8lu kB\n",
524+
atomic_long_read(&direct_pages_count[MMU_PAGE_16M]) << 14);
525+
seq_printf(m, "DirectMap16G: %8lu kB\n",
526+
atomic_long_read(&direct_pages_count[MMU_PAGE_16G]) << 24);
527+
}
527528
}
528529
#endif /* CONFIG_PROC_FS */
529530

0 commit comments

Comments
 (0)