diff options
author | Adam Litke <agl@us.ibm.com> | 2007-10-16 01:26:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 09:43:03 -0700 |
commit | 6b0c880dfefecedb9ad353014ed41505c32aca82 (patch) | |
tree | 2cf472a539f6de265deede9fb580be821bf9dda1 /lib/cpumask.c | |
parent | e63e1e5a6b75416ab758025fd80e247c4f103b1b (diff) | |
download | linux-6b0c880dfefecedb9ad353014ed41505c32aca82.tar.gz linux-6b0c880dfefecedb9ad353014ed41505c32aca82.tar.bz2 linux-6b0c880dfefecedb9ad353014ed41505c32aca82.zip |
hugetlb: fix pool resizing corner case
When shrinking the size of the hugetlb pool via the nr_hugepages sysctl, we
are careful to keep enough pages around to satisfy reservations. But the
calculation is flawed for the following scenario:
Action Pool Counters (Total, Free, Resv)
====== =============
Set pool to 1 page 1 1 0
Map 1 page MAP_PRIVATE 1 1 0
Touch the page to fault it in 1 0 0
Set pool to 3 pages 3 2 0
Map 2 pages MAP_SHARED 3 2 2
Set pool to 2 pages 2 1 2 <-- Mistake, should be 3 2 2
Touch the 2 shared pages 2 0 1 <-- Program crashes here
The last touch above will terminate the process due to lack of huge pages.
This patch corrects the calculation so that it factors in pages being used
for private mappings. Andrew, this is a standalone fix suitable for
mainline. It is also now corrected in my latest dynamic pool resizing
patchset which I will send out soon.
Signed-off-by: Adam Litke <agl@us.ibm.com>
Acked-by: Ken Chen <kenchen@google.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/cpumask.c')
0 files changed, 0 insertions, 0 deletions