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>
This commit is contained in:
committed by
Ingo Molnar
parent
ce0c0e50f9
commit
65280e613f
@@ -34,19 +34,41 @@ struct cpa_data {
|
|||||||
unsigned force_split : 1;
|
unsigned force_split : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROC_FS
|
||||||
static unsigned long direct_pages_count[PG_LEVEL_NUM];
|
static unsigned long direct_pages_count[PG_LEVEL_NUM];
|
||||||
|
|
||||||
void __meminit update_page_count(int level, unsigned long pages)
|
void update_page_count(int level, unsigned long pages)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PROC_FS
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
/* Protect against CPA */
|
/* Protect against CPA */
|
||||||
spin_lock_irqsave(&pgd_lock, flags);
|
spin_lock_irqsave(&pgd_lock, flags);
|
||||||
direct_pages_count[level] += pages;
|
direct_pages_count[level] += pages;
|
||||||
spin_unlock_irqrestore(&pgd_lock, flags);
|
spin_unlock_irqrestore(&pgd_lock, flags);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void split_page_count(int level)
|
||||||
|
{
|
||||||
|
direct_pages_count[level]--;
|
||||||
|
direct_pages_count[level - 1] += PTRS_PER_PTE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int arch_report_meminfo(char *page)
|
||||||
|
{
|
||||||
|
int n = sprintf(page, "DirectMap4k: %8lu\n"
|
||||||
|
"DirectMap2M: %8lu\n",
|
||||||
|
direct_pages_count[PG_LEVEL_4K],
|
||||||
|
direct_pages_count[PG_LEVEL_2M]);
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
|
n += sprintf(page + n, "DirectMap1G: %8lu\n",
|
||||||
|
direct_pages_count[PG_LEVEL_1G]);
|
||||||
|
#endif
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline void split_page_count(int level) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
|
|
||||||
static inline unsigned long highmap_start_pfn(void)
|
static inline unsigned long highmap_start_pfn(void)
|
||||||
@@ -514,10 +536,8 @@ static int split_large_page(pte_t *kpte, unsigned long address)
|
|||||||
set_pte(&pbase[i], pfn_pte(pfn, ref_prot));
|
set_pte(&pbase[i], pfn_pte(pfn, ref_prot));
|
||||||
|
|
||||||
if (address >= (unsigned long)__va(0) &&
|
if (address >= (unsigned long)__va(0) &&
|
||||||
address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT)) {
|
address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT))
|
||||||
direct_pages_count[level]--;
|
split_page_count(level);
|
||||||
direct_pages_count[level - 1] += PTRS_PER_PTE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Install the new, split up pagetable. Important details here:
|
* Install the new, split up pagetable. Important details here:
|
||||||
@@ -1048,22 +1068,6 @@ bool kernel_page_present(struct page *page)
|
|||||||
|
|
||||||
#endif /* CONFIG_DEBUG_PAGEALLOC */
|
#endif /* CONFIG_DEBUG_PAGEALLOC */
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
|
||||||
int arch_report_meminfo(char *page)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
n = sprintf(page, "DirectMap4k: %8lu\n"
|
|
||||||
"DirectMap2M: %8lu\n",
|
|
||||||
direct_pages_count[PG_LEVEL_4K],
|
|
||||||
direct_pages_count[PG_LEVEL_2M]);
|
|
||||||
#ifdef CONFIG_X86_64
|
|
||||||
n += sprintf(page + n, "DirectMap1G: %8lu\n",
|
|
||||||
direct_pages_count[PG_LEVEL_1G]);
|
|
||||||
#endif
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The testcases use internal knowledge of the implementation that shouldn't
|
* The testcases use internal knowledge of the implementation that shouldn't
|
||||||
* be exposed to the rest of the kernel. Include these directly here.
|
* be exposed to the rest of the kernel. Include these directly here.
|
||||||
|
@@ -372,7 +372,11 @@ enum {
|
|||||||
PG_LEVEL_NUM
|
PG_LEVEL_NUM
|
||||||
};
|
};
|
||||||
|
|
||||||
void update_page_count(int level, unsigned long pages);
|
#ifdef CONFIG_PROC_FS
|
||||||
|
extern void update_page_count(int level, unsigned long pages);
|
||||||
|
#else
|
||||||
|
static inline void update_page_count(int level, unsigned long pages) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function that returns the kernel pagetable entry controlling
|
* Helper function that returns the kernel pagetable entry controlling
|
||||||
|
Reference in New Issue
Block a user