From 37cd944c8d8f406eee8e0c580f823ff66738c0af Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Fri, 20 May 2016 08:08:14 +0200 Subject: s390/pgtable: add mapping statistics Add statistics that show how memory is mapped within the kernel identity mapping. This is more or less the same like git commit ce0c0e50f94e ("x86, generic: CPA add statistics about state of direct mapping v4") for x86. I also intentionally copied the lower case "k" within DirectMap4k vs the upper case "M" and "G" within the two other lines. Let's have consistent inconsistencies across architectures. The output of /proc/meminfo now contains these additional lines: DirectMap4k: 2048 kB DirectMap1M: 3991552 kB DirectMap2G: 4194304 kB The implementation on s390 is lockless unlike the x86 version, since I assume changes to the kernel mapping are a very rare event. Therefore it really doesn't matter if these statistics could potentially be inconsistent if read while kernel pages tables are being changed. Signed-off-by: Heiko Carstens Acked-by: Martin Schwidefsky Signed-off-by: Martin Schwidefsky --- arch/s390/include/asm/pgtable.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'arch/s390/include/asm/pgtable.h') diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 9133388edd1f..3038edb12cad 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,24 @@ extern void vmem_map_init(void); pmd_t *vmem_pmd_alloc(void); pte_t *vmem_pte_alloc(void); +enum { + PG_DIRECT_MAP_4K = 0, + PG_DIRECT_MAP_1M, + PG_DIRECT_MAP_2G, + PG_DIRECT_MAP_MAX +}; + +extern atomic_long_t direct_pages_count[PG_DIRECT_MAP_MAX]; + +static inline void update_page_count(int level, long count) +{ + if (IS_ENABLED(CONFIG_PROC_FS)) + atomic_long_add(count, &direct_pages_count[level]); +} + +struct seq_file; +void arch_report_meminfo(struct seq_file *m); + /* * The S390 doesn't have any external MMU info: the kernel page * tables contain all the necessary information. -- cgit v1.2.3