Commit 20078cee authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[PATCH] hugetlb: remove sysctl.c intrusion

Patch from William Lee Irwin III <wli@holomorphy.com>

This patch removes hugetlb's intrusion into kernel/sysctl.c
parent db6005a2
...@@ -546,6 +546,13 @@ int set_hugetlb_mem_size(int count) ...@@ -546,6 +546,13 @@ int set_hugetlb_mem_size(int count)
return (int) htlbzone_pages; return (int) htlbzone_pages;
} }
int hugetlb_sysctl_handler(ctl_table *table, int write, struct file *file, void *buffer, size_t *length)
{
proc_dointvec(table, write, file, buffer, length);
htlbpage_max = set_hugetlb_mem_size(htlbpage_max);
return 0;
}
static int __init hugetlb_setup(char *s) static int __init hugetlb_setup(char *s)
{ {
if (sscanf(s, "%d", &htlbpage_max) <= 0) if (sscanf(s, "%d", &htlbpage_max) <= 0)
......
...@@ -2,17 +2,24 @@ ...@@ -2,17 +2,24 @@
#define _LINUX_HUGETLB_H #define _LINUX_HUGETLB_H
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
struct ctl_table;
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{ {
return vma->vm_flags & VM_HUGETLB; return vma->vm_flags & VM_HUGETLB;
} }
int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void *, size_t *);
int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
int hugetlb_prefault(struct address_space *, struct vm_area_struct *); int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
void huge_page_release(struct page *); void huge_page_release(struct page *);
extern int htlbpage_max;
#else /* !CONFIG_HUGETLB_PAGE */ #else /* !CONFIG_HUGETLB_PAGE */
static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{ {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <linux/sysrq.h> #include <linux/sysrq.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/hugetlb.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS
...@@ -99,11 +99,6 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp, ...@@ -99,11 +99,6 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
extern int acct_parm[]; extern int acct_parm[];
#endif #endif
#ifdef CONFIG_HUGETLB_PAGE
extern int htlbpage_max;
extern int set_hugetlb_mem_size(int);
#endif
static int parse_table(int *, int, void *, size_t *, void *, size_t, static int parse_table(int *, int, void *, size_t *, void *, size_t,
ctl_table *, void **); ctl_table *, void **);
static int proc_doutsstring(ctl_table *table, int write, struct file *filp, static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
...@@ -315,8 +310,7 @@ static ctl_table vm_table[] = { ...@@ -315,8 +310,7 @@ static ctl_table vm_table[] = {
0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &zero, 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &zero,
&one_hundred }, &one_hundred },
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
{VM_HUGETLB_PAGES, "nr_hugepages", &htlbpage_max, sizeof(int), 0644, NULL, {VM_HUGETLB_PAGES, "nr_hugepages", &htlbpage_max, sizeof(int), 0644, NULL, &hugetlb_sysctl_handler},
&proc_dointvec},
#endif #endif
{0} {0}
}; };
...@@ -907,10 +901,6 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, ...@@ -907,10 +901,6 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
val = -val; val = -val;
buffer += len; buffer += len;
left -= len; left -= len;
#ifdef CONFIG_HUGETLB_PAGE
if (i == &htlbpage_max)
val = set_hugetlb_mem_size(val);
#endif
switch(op) { switch(op) {
case OP_SET: *i = val; break; case OP_SET: *i = val; break;
case OP_AND: *i &= val; break; case OP_AND: *i &= val; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment