hugetlb: remove /proc/ intrusion
Subsystems (2)
PATCH 6/7 hugetlb: remove /proc/ intrusion
This patch removes hugetlb's intrusion into /proc/
arch/i386/mm/hugetlbpage.c | 11 +++++++++++ fs/proc/proc_misc.c | 15 ++------------- include/linux/hugetlb.h | 2 ++ 3 files changed, 15 insertions(+), 13 deletions(-)
arch/i386/mm/hugetlbpage.c +11 -0
@@ -549,6 +549,17 @@ static int __init hugetlb_init(void) }module_init (hugetlb_init); +int hugetlb_report_meminfo (char *buf) +{ +return sprintf (buf, +"HugePages_Total: %5lu\n" +"HugePages_Free: %5lu\n" +"Hugepagesize: %5lu kB\n" , + htlbzone_pages, + htlbpagemem, +HPAGE_SIZE /1024 ); +} +static struct page *hugetlb_nopage (struct vm_area_struct * area,unsigned long address,int unused) {BUG ();
fs/proc/proc_misc.c +2 -13
@@ -40,7 +40,7 @@#include <linux/times.h> #include <linux/profile.h> #include <linux/blkdev.h> - +#include <linux/hugetlb.h> #include <asm/uaccess.h> #include <asm/pgtable.h> #include <asm/io.h>
@@ -199,19 +199,8 @@ static int meminfo_read_proc(char *page, ps.nr_reverse_maps ); -#ifdef CONFIG_HUGETLB_PAGE - { -extern unsigned long htlbpagemem, htlbzone_pages; - len +=sprintf (page + len, -"HugePages_Total: %5lu\n" -"HugePages_Free: %5lu\n" -"Hugepagesize: %5lu kB\n" , - htlbzone_pages, - htlbpagemem, -HPAGE_SIZE /1024 ); - } + len +=hugetlb_report_meminfo (page + len); -#endif return proc_calc_metrics (page, start, off, count, eof, len);#undef K }
include/linux/hugetlb.h +2 -0
@@ -17,6 +17,7 @@ void zap_hugepage_range(struct vm_area_svoid unmap_hugepage_range (struct vm_area_struct *,unsigned long ,unsigned long );int hugetlb_prefault (struct address_space *,struct vm_area_struct *);void huge_page_release (struct page *); +int hugetlb_report_meminfo (char *);extern int htlbpage_max;
@@ -32,6 +33,7 @@ static inline int is_vm_hugetlb_page(str#define zap_hugepage_range (vma, start, len) BUG()#define unmap_hugepage_range (vma, start, end) BUG()#define huge_page_release (page) BUG() +#define hugetlb_report_meminfo (buf) 0#endif /* !CONFIG_HUGETLB_PAGE */