From: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: David Gibson <david@gibson.dropbear.id.au>, kenneth.w.chen@intel.com
Subject: [PATCH] hugetlb_no_page might break hugetlb quota
Date: Mon, 06 Mar 2006 14:21:36 +0800 [thread overview]
Message-ID: <1141626096.29825.13.camel@ymzhang-perf.sh.intel.com> (raw)
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;
next reply other threads:[~2006-03-06 6:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 6:21 Zhang, Yanmin [this message]
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'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1141626096.29825.13.camel@ymzhang-perf.sh.intel.com \
--to=yanmin_zhang@linux.intel.com \
--cc=david@gibson.dropbear.id.au \
--cc=kenneth.w.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®