From: Ken Chen Date: Tue, 24 Jul 2007 01:44:00 +0000 (-0700) Subject: fix hugetlb page allocation leak X-Git-Tag: upstream/snapshot3+hdmi~31870 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ab3ee7b1cd5c91eb2272764f9d7d1fe4749681e;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git fix hugetlb page allocation leak dequeue_huge_page() has a serious memory leak upon hugetlb page allocation. The for loop continues on allocating hugetlb pages out of all allowable zone, where this function is supposedly only dequeue one and only one pages. Fixed it by breaking out of the for loop once a hugetlb page is found. Signed-off-by: Ken Chen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f127940..d7ca59d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -84,6 +84,7 @@ static struct page *dequeue_huge_page(struct vm_area_struct *vma, list_del(&page->lru); free_huge_pages--; free_huge_pages_node[nid]--; + break; } } return page;