aboutsummaryrefslogtreecommitdiff
path: root/net/unix/sysctl_net_unix.c
diff options
context:
space:
mode:
authorAdam Litke <[email protected]>2008-03-04 14:29:38 -0800
committerLinus Torvalds <[email protected]>2008-03-04 16:35:18 -0800
commitac09b3a15154af5f081fed509c6c3662e79de785 (patch)
tree753170e02fafcadbd525d93b01105a4995d51461 /net/unix/sysctl_net_unix.c
parenta07e6ab41be179cf1ed728a4f41368435508b550 (diff)
hugetlb: close a difficult to trigger reservation race
A hugetlb reservation may be inadequately backed in the event of racing allocations and frees when utilizing surplus huge pages. Consider the following series of events in processes A and B: A) Allocates some surplus pages to satisfy a reservation B) Frees some huge pages A) A notices the extra free pages and drops hugetlb_lock to free some of its surplus pages back to the buddy allocator. B) Allocates some huge pages A) Reacquires hugetlb_lock and returns from gather_surplus_huge_pages() Avoid this by commiting the reservation after pages have been allocated but before dropping the lock to free excess pages. For parity, release the reservation in return_unused_surplus_pages(). This patch also corrects the cpuset_mems_nr() error path in hugetlb_acct_memory(). If the cpuset check fails, uncommit the reservation, but also be sure to return any surplus huge pages that may have been allocated to back the failed reservation. Thanks to Andy Whitcroft for discovering this. Signed-off-by: Adam Litke <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: Dave Hansen <[email protected]> Cc: William Lee Irwin III <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: Mel Gorman <[email protected]> Cc: David Gibson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/unix/sysctl_net_unix.c')
0 files changed, 0 insertions, 0 deletions