From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
Ian.Campbell@citrix.com, hpa@zytor.com, x86@kernel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 2/3] xen/p2m: Reserve 4MB of _brk space for P2M leafs when populating back.
Date: Tue, 31 Jul 2012 06:42:55 -0400 [thread overview]
Message-ID: <1343731376-20658-3-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1343731376-20658-1-git-send-email-konrad.wilk@oracle.com>
When we release pages back during bootup:
Freeing 9d-100 pfn range: 99 pages freed
Freeing 9cf36-9d0d2 pfn range: 412 pages freed
Freeing 9f6bd-9f6bf pfn range: 2 pages freed
Freeing 9f714-9f7bf pfn range: 171 pages freed
Freeing 9f7e0-9f7ff pfn range: 31 pages freed
Freeing 9f800-100000 pfn range: 395264 pages freed
Released 395979 pages of unused memory
We then try to populate those pages back. In the P2M tree however
the space for those leafs must be reserved - as such we use extend_brk.
We reserve 4MB of _brk space, which means we can fit over
524288 PFNs - which should be more than enough to cover. If we do
run over that number, the code is smart enough to stop and not
allocate anymore leafs.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/xen/p2m.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 1658af0..0aa61ef 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -194,6 +194,12 @@ RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID
* boundary violation will require three middle nodes. */
RESERVE_BRK(p2m_mid_identity, PAGE_SIZE * 2 * 3);
+/* When we populate back during bootup, the amount of pages can vary. The
+ * max we have is seen is 395979, but that does not mean it can't be more.
+ * So reserve enough for 524288 pages (2G of I/O and E820 holes). Note:
+ * We are smart enough to stop exhausting the _brk if we are close to
+ * exhaustion. */
+RESERVE_BRK(p2m_populated, PMD_SIZE * 2);
static inline unsigned p2m_top_index(unsigned long pfn)
{
BUG_ON(pfn >= MAX_P2M_PFN);
--
1.7.7.6
next prev parent reply other threads:[~2012-07-31 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 10:42 [PATCH] extend_brk and fixes to users of extend_brk (v1) Konrad Rzeszutek Wilk
2012-07-31 10:42 ` [PATCH 1/3] xen/mmu/p2m: Check extend_brk for NULL Konrad Rzeszutek Wilk
2012-07-31 13:48 ` Konrad Rzeszutek Wilk
2012-07-31 10:42 ` Konrad Rzeszutek Wilk [this message]
2012-07-31 10:42 ` [PATCH 3/3] x86: Let extend_brk return a NULL pointer instead of just BUG_ON Konrad Rzeszutek Wilk
2012-07-31 15:49 ` [PATCH] extend_brk and fixes to users of extend_brk (v1) H. Peter Anvin
2012-07-31 16:15 ` Konrad Rzeszutek Wilk
2012-07-31 16:41 ` [Xen-devel] " Jan Beulich
2012-07-31 17:29 ` Konrad Rzeszutek Wilk
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=1343731376-20658-3-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
/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;
as well as URLs for NNTP newsgroup(s).