提交 c033a93c 编写于 作者: P Petr Holasek 提交者: Linus Torvalds

hugetlbfs: correct handling of negative input to /proc/sys/vm/nr_hugepages

When the user inserts a negative value into /proc/sys/vm/nr_hugepages it
will cause the kernel to allocate as many hugepages as possible and to
then update /proc/meminfo to reflect this.

This changes the behavior so that the negative input will result in
nr_hugepages value being unchanged.
Signed-off-by: NPetr Holasek <pholasek@redhat.com>
Signed-off-by: NAnton Arapov <anton@redhat.com>
Reviewed-by: NNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: NDavid Rientjes <rientjes@google.com>
Acked-by: NMel Gorman <mel@csn.ul.ie>
Acked-by: NEric B Munson <emunson@mgebm.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 8afdcece
......@@ -1872,8 +1872,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
unsigned long tmp;
int ret;
if (!write)
tmp = h->max_huge_pages;
tmp = h->max_huge_pages;
if (write && h->order >= MAX_ORDER)
return -EINVAL;
......@@ -1938,8 +1937,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
unsigned long tmp;
int ret;
if (!write)
tmp = h->nr_overcommit_huge_pages;
tmp = h->nr_overcommit_huge_pages;
if (write && h->order >= MAX_ORDER)
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册