diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2008-02-08 04:18:18 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-25 16:18:32 -0800 |
commit | 091a61f602b7db7f4d1fdcb41e6ff9a97a6e0cce (patch) | |
tree | 7fc9bcea67c3491bbdc10aa3310ca08f498aa1aa /mm | |
parent | 0cc3ec3d1add90d860786382dc5abe7ca94d242e (diff) |
hugetlb: add locking for overcommit sysctl
patch a3d0c6aa1bb342b9b2c7b123b52ac2f48a4d4d0a in mainline.
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 <nacc@us.ibm.com>
Acked-by: Adam Litke <agl@us.ibm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index db861d8b6c28..9c746cbb436a 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) |