diff options
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r-- | arch/x86/mm/pageattr.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 60bcb5b6a37e..afd40054d157 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -34,6 +34,41 @@ struct cpa_data { | |||
34 | unsigned force_split : 1; | 34 | unsigned force_split : 1; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #ifdef CONFIG_PROC_FS | ||
38 | static unsigned long direct_pages_count[PG_LEVEL_NUM]; | ||
39 | |||
40 | void update_page_count(int level, unsigned long pages) | ||
41 | { | ||
42 | unsigned long flags; | ||
43 | |||
44 | /* Protect against CPA */ | ||
45 | spin_lock_irqsave(&pgd_lock, flags); | ||
46 | direct_pages_count[level] += pages; | ||
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]); | ||
65 | #endif | ||
66 | return n; | ||
67 | } | ||
68 | #else | ||
69 | static inline void split_page_count(int level) { } | ||
70 | #endif | ||
71 | |||
37 | #ifdef CONFIG_X86_64 | 72 | #ifdef CONFIG_X86_64 |
38 | 73 | ||
39 | static inline unsigned long highmap_start_pfn(void) | 74 | static inline unsigned long highmap_start_pfn(void) |
@@ -500,6 +535,10 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
500 | for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc) | 535 | for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc) |
501 | set_pte(&pbase[i], pfn_pte(pfn, ref_prot)); | 536 | set_pte(&pbase[i], pfn_pte(pfn, ref_prot)); |
502 | 537 | ||
538 | if (address >= (unsigned long)__va(0) && | ||
539 | address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT)) | ||
540 | split_page_count(level); | ||
541 | |||
503 | /* | 542 | /* |
504 | * Install the new, split up pagetable. Important details here: | 543 | * Install the new, split up pagetable. Important details here: |
505 | * | 544 | * |
@@ -805,7 +844,7 @@ int _set_memory_wc(unsigned long addr, int numpages) | |||
805 | 844 | ||
806 | int set_memory_wc(unsigned long addr, int numpages) | 845 | int set_memory_wc(unsigned long addr, int numpages) |
807 | { | 846 | { |
808 | if (!pat_wc_enabled) | 847 | if (!pat_enabled) |
809 | return set_memory_uc(addr, numpages); | 848 | return set_memory_uc(addr, numpages); |
810 | 849 | ||
811 | if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, | 850 | if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, |