mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hugetlb_no_page might break hugetlb quota
@ 2006-03-06  6:21 Zhang, Yanmin
  2006-03-06  8:15 ` Chen, Kenneth W
  0 siblings, 1 reply; 12+ messages in thread
From: Zhang, Yanmin @ 2006-03-06  6:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Gibson, kenneth.w.chen

From: Zhang Yanmin <yanmin.zhang@intel.com>

In function hugetlb_no_page, backout path always calls hugetlb_put_quota.
It's incorrect when find_lock_page gets the page or the new page is added
into page cache.

In addition, if the vma->vm_flags doesn't include VM_SHARED, the quota
shouldn't be decreased.

My patch against 2.6.16-rc5-mm2 fixes it.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>

---

diff -Nraup linux-2.6.16-rc5-mm2/mm/hugetlb.c linux-2.6.16-rc5-mm2_quota/mm/hugetlb.c
--- linux-2.6.16-rc5-mm2/mm/hugetlb.c	2006-03-06 18:48:18.000000000 +0800
+++ linux-2.6.16-rc5-mm2_quota/mm/hugetlb.c	2006-03-06 18:48:58.000000000 +0800
@@ -562,11 +562,12 @@ int hugetlb_no_page(struct mm_struct *mm
 retry:
 	page = find_lock_page(mapping, idx);
 	if (!page) {
-		if (hugetlb_get_quota(mapping))
+		if (vma->vm_flags & VM_SHARED && hugetlb_get_quota(mapping))
 			goto out;
 		page = alloc_huge_page(vma, address);
 		if (!page) {
-			hugetlb_put_quota(mapping);
+			if (vma->vm_flags & VM_SHARED)
+				hugetlb_put_quota(mapping);
 			ret = VM_FAULT_OOM;
 			goto out;
 		}
@@ -613,7 +614,6 @@ out:
 
 backout:
 	spin_unlock(&mm->page_table_lock);
-	hugetlb_put_quota(mapping);
 	unlock_page(page);
 	put_page(page);
 	goto out;



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-03-09  1:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-06  6:21 [PATCH] hugetlb_no_page might break hugetlb quota Zhang, Yanmin
2006-03-06  8:15 ` Chen, Kenneth W
2006-03-06  9:06   ` Zhang, Yanmin
2006-03-08  3:14     ` Zhang, Yanmin
2006-03-08  3:24       ` [PATCH] ftruncate on huge page couldn't extend hugetlb file Zhang, Yanmin
     [not found]         ` <20060307222148.76e5dc45.akpm@osdl.org>
2006-03-08  6:54           ` Zhang, Yanmin
2006-03-08 18:28         ` Chen, Kenneth W
2006-03-08 23:58           ` David Gibson
2006-03-09  0:12             ` Chen, Kenneth W
2006-03-09  0:22               ` 'David Gibson'
2006-03-09  0:33                 ` Chen, Kenneth W
2006-03-09  1:03                   ` 'David Gibson'

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®