Commit:     ace4bd29c248b51db3f8a97e9b59740dc6caa074
Parent:     ba8b45cea5f632540d561d37d94c71c07f6af1aa
Author:     Ken Chen <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 02:33:09 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 9 12:30:48 2007 -0700

    fix leaky resv_huge_pages when cpuset is in use
    The internal hugetlb resv_huge_pages variable can permanently leak nonzero
    value in the error path of hugetlb page fault handler when hugetlb page is
    used in combination of cpuset.  The leaked count can permanently trap N
    number of hugetlb pages in unusable "reserved" state.
    Steps to reproduce the bug:
      (1) create two cpuset, user1 and user2
      (2) reserve 50 htlb pages in cpuset user1
      (3) attempt to shmget/shmat 50 htlb page inside cpuset user2
      (4) kernel oom the user process in step 3
      (5) ipcrm the shm segment
    At this point resv_huge_pages will have a count of 49, even though
    there are no active hugetlbfs file nor hugetlb shared memory segment
    in the system.  The leak is permanent and there is no recovery method
    other than system reboot. The leaked count will hold up all future use
    of that many htlb pages in all cpusets.
    The culprit is that the error path of alloc_huge_page() did not
    properly undo the change it made to resv_huge_page, causing
    inconsistent state.
    Signed-off-by: Ken Chen <[EMAIL PROTECTED]>
    Cc: David Gibson <[EMAIL PROTECTED]>
    Cc: Adam Litke <[EMAIL PROTECTED]>
    Cc: Martin Bligh <[EMAIL PROTECTED]>
    Acked-by: David Gibson <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 mm/hugetlb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 36db012..88e708b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -140,6 +140,8 @@ static struct page *alloc_huge_page(struct vm_area_struct 
        return page;
+       if (vma->vm_flags & VM_MAYSHARE)
+               resv_huge_pages++;
        return NULL;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to