Staging
v0.8.1
v0.8.1
https://github.com/torvalds/linux
Revision 0bd0f9fb190a0fc0fb25b764c8b04869711f7657 authored by Eric Paris on 22 November 2005, 05:32:28 UTC, committed by Linus Torvalds on 22 November 2005, 17:13:43 UTC
If there are multiple updaters to /proc/sys/vm/nr_hugepages simultaneously it is possible for the nr_huge_pages variable to become incorrect. There is no locking in the set_max_huge_pages function around alloc_fresh_huge_page which is able to update nr_huge_pages. Two callers to alloc_fresh_huge_page could race against each other as could a call to alloc_fresh_huge_page and a call to update_and_free_page. This patch just expands the area covered by the hugetlb_lock to cover the call into alloc_fresh_huge_page. I'm not sure how we could say that a sysctl section is performance critical where more specific locking would be needed. My reproducer was to run a couple copies of the following script simultaneously while [ true ]; do echo 1000 > /proc/sys/vm/nr_hugepages echo 500 > /proc/sys/vm/nr_hugepages echo 750 > /proc/sys/vm/nr_hugepages echo 100 > /proc/sys/vm/nr_hugepages echo 0 > /proc/sys/vm/nr_hugepages done and then watch /proc/meminfo and eventually you will see things like HugePages_Total: 100 HugePages_Free: 109 After applying the patch all seemed well. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: William Irwin <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 5ef897c
Tip revision: 0bd0f9fb190a0fc0fb25b764c8b04869711f7657 authored by Eric Paris on 22 November 2005, 05:32:28 UTC
[PATCH] hugetlb: fix race in set_max_huge_pages for multiple updaters of nr_huge_pages
[PATCH] hugetlb: fix race in set_max_huge_pages for multiple updaters of nr_huge_pages
Tip revision: 0bd0f9f
File | Mode | Size |
---|---|---|
Documentation | ||
arch | ||
block | ||
crypto | ||
drivers | ||
fs | ||
include | ||
init | ||
ipc | ||
kernel | ||
lib | ||
mm | ||
net | ||
scripts | ||
security | ||
sound | ||
usr | ||
.gitignore | -rw-r--r-- | 391 bytes |
COPYING | -rw-r--r-- | 18.3 KB |
CREDITS | -rw-r--r-- | 87.5 KB |
Kbuild | -rw-r--r-- | 1.2 KB |
MAINTAINERS | -rw-r--r-- | 62.3 KB |
Makefile | -rw-r--r-- | 42.8 KB |
README | -rw-r--r-- | 14.7 KB |
REPORTING-BUGS | -rw-r--r-- | 3.0 KB |
Computing file changes ...