Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a3d0c6aa1bb342b9b2c7b123b52ac2f48a4d4d0a
Commit:     a3d0c6aa1bb342b9b2c7b123b52ac2f48a4d4d0a
Parent:     ac74c00e499ed276a965e5b5600667d5dc04a84a
Author:     Nishanth Aravamudan <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 8 04:18:18 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Feb 8 09:22:23 2008 -0800

    hugetlb: add locking for overcommit sysctl
    
    When I replaced hugetlb_dynamic_pool with nr_overcommit_hugepages I used
    proc_doulongvec_minmax() directly.  However, hugetlb.c's locking rules
    require that all counter modifications occur under the hugetlb_lock.  Add a
    callback into the hugetlb code similar to the one for nr_hugepages.  Grab
    the lock around the manipulation of nr_overcommit_hugepages in
    proc_doulongvec_minmax().
    
    Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
    Acked-by: Adam Litke <[EMAIL PROTECTED]>
    Cc: David Gibson <[EMAIL PROTECTED]>
    Cc: William Lee Irwin III <[EMAIL PROTECTED]>
    Cc: <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/linux/hugetlb.h |    1 +
 kernel/sysctl.c         |    2 +-
 mm/hugetlb.c            |   10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 30d606a..7ca198b 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -17,6 +17,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct 
*vma)
 }
 
 int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user 
*, size_t *, loff_t *);
+int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void 
__user *, size_t *, loff_t *);
 int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void 
__user *, size_t *, loff_t *);
 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);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8c98d81..9dadc9d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -982,7 +982,7 @@ static struct ctl_table vm_table[] = {
                .data           = &nr_overcommit_huge_pages,
                .maxlen         = sizeof(nr_overcommit_huge_pages),
                .mode           = 0644,
-               .proc_handler   = &proc_doulongvec_minmax,
+               .proc_handler   = &hugetlb_overcommit_handler,
        },
 #endif
        {
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1a56420..d9a3803 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -605,6 +605,16 @@ int hugetlb_treat_movable_handler(struct ctl_table *table, 
int write,
        return 0;
 }
 
+int hugetlb_overcommit_handler(struct ctl_table *table, int write,
+                       struct file *file, void __user *buffer,
+                       size_t *length, loff_t *ppos)
+{
+       spin_lock(&hugetlb_lock);
+       proc_doulongvec_minmax(table, write, file, buffer, length, ppos);
+       spin_unlock(&hugetlb_lock);
+       return 0;
+}
+
 #endif /* CONFIG_SYSCTL */
 
 int hugetlb_report_meminfo(char *buf)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to