]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Add hugetlbfs accounting fix from Hugh
authorChris Wright <chrisw@sous-sol.org>
Mon, 13 Feb 2006 19:22:03 +0000 (11:22 -0800)
committerChris Wright <chrisw@sous-sol.org>
Mon, 13 Feb 2006 19:22:03 +0000 (11:22 -0800)
queue/hugetlbfs-mmap-enomem-failure.patch [new file with mode: 0644]
queue/series

diff --git a/queue/hugetlbfs-mmap-enomem-failure.patch b/queue/hugetlbfs-mmap-enomem-failure.patch
new file mode 100644 (file)
index 0000000..fdf9170
--- /dev/null
@@ -0,0 +1,39 @@
+From stable-bounces@linux.kernel.org  Sun Feb 12 11:28:34 2006
+Date: Sun, 12 Feb 2006 19:26:05 +0000 (GMT)
+From: Hugh Dickins <hugh@veritas.com>
+To: stable@kernel.org
+Cc: Don Dupuis <dondster@gmail.com>, William Irwin <wli@holomorphy.com>,
+        Adam Litke <agl@us.ibm.com>
+Subject: [PATCH] hugetlbfs mmap ENOMEM failure
+
+
+2.6.15's hugepage faulting introduced huge_pages_needed accounting into
+hugetlbfs: to count how many pages are already in cache, for spot check
+on how far a new mapping may be allowed to extend the file.  But it's
+muddled: each hugepage found covers HPAGE_SIZE, not PAGE_SIZE.  Once
+pages were already in cache, it would overshoot, wrap its hugepages
+count backwards, and so fail a harmless repeat mapping with -ENOMEM.
+Fixes the problem found by Don Dupuis.
+
+Signed-off-by: Hugh Dickins <hugh@veritas.com>
+Acked-By: Adam Litke <agl@us.ibm.com>
+Acked-by: William Irwin <wli@us.ibm.com>
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+
+ fs/hugetlbfs/inode.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+--- linux-2.6.15.4.orig/fs/hugetlbfs/inode.c
++++ linux-2.6.15.4/fs/hugetlbfs/inode.c
+@@ -71,8 +71,8 @@ huge_pages_needed(struct address_space *
+       unsigned long start = vma->vm_start;
+       unsigned long end = vma->vm_end;
+       unsigned long hugepages = (end - start) >> HPAGE_SHIFT;
+-      pgoff_t next = vma->vm_pgoff;
+-      pgoff_t endpg = next + ((end - start) >> PAGE_SHIFT);
++      pgoff_t next = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
++      pgoff_t endpg = next + hugepages;
+       pagevec_init(&pvec, 0);
+       while (next < endpg) {
index 94b5e65df3a16e2583644d7143d52a7475f9ad65..bc10f1ee8468b6c3866d1fb01b878d190c6e88f1 100644 (file)
@@ -3,3 +3,4 @@ s390-klibc-build-fix-for-2.6.15.patch
 shmdt-cannot-detach-not-alined-shm-segment-cleanly.patch
 netfilter-missing-symbol.patch
 i386-move-phys_proc_id-early-intel-workaround-to-correct-function.patch
+hugetlbfs-mmap-enomem-failure.patch