From: Adam Litke <agl@us.ibm.com>
To: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: wli@holomorphy.com, linux-mm@kvack.org
Subject: Re: [PATCH] hugetlb: add locking for overcommit sysctl
Date: Thu, 07 Feb 2008 09:19:44 -0600 [thread overview]
Message-ID: <1202397584.11987.0.camel@localhost.localdomain> (raw)
In-Reply-To: <20080206230259.GD3477@us.ibm.com>
On Wed, 2008-02-06 at 15:02 -0800, Nishanth Aravamudan wrote:
> 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>
> ---
> I noticed that the nr_hugepages sysctl uses a helper variable,
> max_huge_pages to do the same thing. Is that because of locking
> requirements (undocmented) for proc_doulongvec_minmax() or because of
> the more complicated manipulation of the pool state for that sysctl? If
> the former, I will need to modify this patch.
>
> 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 5e2ad5b..92fef8d 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -973,7 +973,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)
>
--
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-02-07 15:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 23:02 Nishanth Aravamudan
2008-02-07 15:19 ` Adam Litke [this message]
2008-02-07 16:51 ` Nishanth Aravamudan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1202397584.11987.0.camel@localhost.localdomain \
--to=agl@us.ibm.com \
--cc=linux-mm@kvack.org \
--cc=nacc@us.ibm.com \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox