[PATCH] hugetlb.c - fix try_to_free_low()
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com> Turn on CONFIG_HIGHMEM and CONFIG_HUGETLBFS. Try to config the hugetlb pool: [root@quokka]# echo 100 > /proc/sys/vm/nr_hugepages [root@quokka]# grep HugePage /proc/meminfo HugePages_Total: 100 HugePages_Free: 100 [root@quokka]# echo 20 > /proc/sys/vm/nr_hugepages [root@quokka]# grep HugePage /proc/meminfo HugePages_Total: 0 HugePages_Free: 0 [root@quokka]# echo 100 > /proc/sys/vm/nr_hugepages [root@quokka]# grep HugePage /proc/meminfo HugePages_Total: 100 HugePages_Free: 100 [root@quokka]# echo 0 > /proc/sys/vm/nr_hugepages [root@quokka]# grep HugePage /proc/meminfo HugePages_Total: 31 HugePages_Free: 31 The argument "count" passed to try_to_free_low() is the config parameter for desired hugetlb page pool size. But the implementation took that input argument as number of pages to free. It also decrement the config parameter as well. All give random behavior depend on how many hugetlb pages are in normal/highmem zone. A two line fix in try_to_free_low() would be: - if (!--count) - return 0; + if (count >= nr_huge_pages) + return count; But more appropriately, that function shouldn't return anything. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing
Please register or sign in to comment