diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-05-05 10:35:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 02:12:05 -0400 |
commit | 65280e613fada41704f35709b6c8952ca4b8750c (patch) | |
tree | bc3dfcff341afcec6db6f2bdba5e62310059f120 /arch/x86/mm | |
parent | ce0c0e50f94e8c55b00a722e8c6e8d6c802be211 (diff) |
x86: janitor CPA statistics patch
1) Remove __meminit from update_pages_count. It is used inside
split_pages()
2) Make the code depend on PROC_FS. Doing statistics for nothing is
useless and not adding useless code is nice to the Linux tiny folks.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/pageattr.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 668205bca15e..0a3f5e047f89 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -34,18 +34,40 @@ struct cpa_data { | |||
34 | unsigned force_split : 1; | 34 | unsigned force_split : 1; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #ifdef CONFIG_PROC_FS | ||
37 | static unsigned long direct_pages_count[PG_LEVEL_NUM]; | 38 | static unsigned long direct_pages_count[PG_LEVEL_NUM]; |
38 | 39 | ||
39 | void __meminit update_page_count(int level, unsigned long pages) | 40 | void update_page_count(int level, unsigned long pages) |
40 | { | 41 | { |
41 | #ifdef CONFIG_PROC_FS | ||
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | |||
43 | /* Protect against CPA */ | 44 | /* Protect against CPA */ |
44 | spin_lock_irqsave(&pgd_lock, flags); | 45 | spin_lock_irqsave(&pgd_lock, flags); |
45 | direct_pages_count[level] += pages; | 46 | direct_pages_count[level] += pages; |
46 | spin_unlock_irqrestore(&pgd_lock, flags); | 47 | spin_unlock_irqrestore(&pgd_lock, flags); |
48 | } | ||
49 | |||
50 | static void split_page_count(int level) | ||
51 | { | ||
52 | direct_pages_count[level]--; | ||
53 | direct_pages_count[level - 1] += PTRS_PER_PTE; | ||
54 | } | ||
55 | |||
56 | int arch_report_meminfo(char *page) | ||
57 | { | ||
58 | int n = sprintf(page, "DirectMap4k: %8lu\n" | ||
59 | "DirectMap2M: %8lu\n", | ||
60 | direct_pages_count[PG_LEVEL_4K], | ||
61 | direct_pages_count[PG_LEVEL_2M]); | ||
62 | #ifdef CONFIG_X86_64 | ||
63 | n += sprintf(page + n, "DirectMap1G: %8lu\n", | ||
64 | direct_pages_count[PG_LEVEL_1G]); | ||
47 | #endif | 65 | #endif |
66 | return n; | ||
48 | } | 67 | } |
68 | #else | ||
69 | static inline void split_page_count(int level) { } | ||
70 | #endif | ||
49 | 71 | ||
50 | #ifdef CONFIG_X86_64 | 72 | #ifdef CONFIG_X86_64 |
51 | 73 | ||
@@ -514,10 +536,8 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
514 | set_pte(&pbase[i], pfn_pte(pfn, ref_prot)); | 536 | set_pte(&pbase[i], pfn_pte(pfn, ref_prot)); |
515 | 537 | ||
516 | if (address >= (unsigned long)__va(0) && | 538 | if (address >= (unsigned long)__va(0) && |
517 | address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT)) { | 539 | address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT)) |
518 | direct_pages_count[level]--; | 540 | split_page_count(level); |
519 | direct_pages_count[level - 1] += PTRS_PER_PTE; | ||
520 | } | ||
521 | 541 | ||
522 | /* | 542 | /* |
523 | * Install the new, split up pagetable. Important details here: | 543 | * Install the new, split up pagetable. Important details here: |
@@ -1048,22 +1068,6 @@ bool kernel_page_present(struct page *page) | |||
1048 | 1068 | ||
1049 | #endif /* CONFIG_DEBUG_PAGEALLOC */ | 1069 | #endif /* CONFIG_DEBUG_PAGEALLOC */ |
1050 | 1070 | ||
1051 | #ifdef CONFIG_PROC_FS | ||
1052 | int arch_report_meminfo(char *page) | ||
1053 | { | ||
1054 | int n; | ||
1055 | n = sprintf(page, "DirectMap4k: %8lu\n" | ||
1056 | "DirectMap2M: %8lu\n", | ||
1057 | direct_pages_count[PG_LEVEL_4K], | ||
1058 | direct_pages_count[PG_LEVEL_2M]); | ||
1059 | #ifdef CONFIG_X86_64 | ||
1060 | n += sprintf(page + n, "DirectMap1G: %8lu\n", | ||
1061 | direct_pages_count[PG_LEVEL_1G]); | ||
1062 | #endif | ||
1063 | return n; | ||
1064 | } | ||
1065 | #endif | ||
1066 | |||
1067 | /* | 1071 | /* |
1068 | * The testcases use internal knowledge of the implementation that shouldn't | 1072 | * The testcases use internal knowledge of the implementation that shouldn't |
1069 | * be exposed to the rest of the kernel. Include these directly here. | 1073 | * be exposed to the rest of the kernel. Include these directly here. |