Commit c033a93c authored by Petr Holasek's avatar Petr Holasek Committed by 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: default avatarPetr Holasek <pholasek@redhat.com>
Signed-off-by: default avatarAnton Arapov <anton@redhat.com>
Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Acked-by: default avatarMel Gorman <mel@csn.ul.ie>
Acked-by: default avatarEric B Munson <emunson@mgebm.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8afdcece
...@@ -1872,7 +1872,6 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, ...@@ -1872,7 +1872,6 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
unsigned long tmp; unsigned long tmp;
int ret; int ret;
if (!write)
tmp = h->max_huge_pages; tmp = h->max_huge_pages;
if (write && h->order >= MAX_ORDER) if (write && h->order >= MAX_ORDER)
...@@ -1938,7 +1937,6 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write, ...@@ -1938,7 +1937,6 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
unsigned long tmp; unsigned long tmp;
int ret; int ret;
if (!write)
tmp = h->nr_overcommit_huge_pages; tmp = h->nr_overcommit_huge_pages;
if (write && h->order >= MAX_ORDER) if (write && h->order >= MAX_ORDER)
......
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