From: Yinghai Lu <yinghai@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@zytor.com>, Jacob Shin <jacob.shin@amd.com>,
Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 2/8] x86, mm: Split out split_mem_range
Date: Thu, 30 Aug 2012 16:06:09 -0700 [thread overview]
Message-ID: <1346367975-6446-3-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1346367975-6446-1-git-send-email-yinghai@kernel.org>
from init_memory_mapping, so make init_memory_mapping readable.
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/mm/init.c | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 838e9bc..7d05e28 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -143,25 +143,13 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,
return nr_range;
}
-/*
- * Setup the direct mapping of the physical memory at PAGE_OFFSET.
- * This runs before bootmem is initialized and gets pages directly from
- * the physical memory. To access them they are temporarily mapped.
- */
-unsigned long __init_refok init_memory_mapping(unsigned long start,
- unsigned long end)
+static int __meminit split_mem_range(struct map_range *mr, int nr_range,
+ unsigned long start,
+ unsigned long end)
{
unsigned long start_pfn, end_pfn;
- unsigned long ret = 0;
unsigned long pos;
- struct map_range mr[NR_RANGE_MR];
- int nr_range, i;
-
- printk(KERN_INFO "init_memory_mapping: [mem %#010lx-%#010lx]\n",
- start, end - 1);
-
- memset(mr, 0, sizeof(mr));
- nr_range = 0;
+ int i;
/* head if not big page alignment ? */
start_pfn = start >> PAGE_SHIFT;
@@ -255,6 +243,28 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
(mr[i].page_size_mask & (1<<PG_LEVEL_1G))?"1G":(
(mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
+ return nr_range;
+}
+
+/*
+ * Setup the direct mapping of the physical memory at PAGE_OFFSET.
+ * This runs before bootmem is initialized and gets pages directly from
+ * the physical memory. To access them they are temporarily mapped.
+ */
+unsigned long __init_refok init_memory_mapping(unsigned long start,
+ unsigned long end)
+{
+ struct map_range mr[NR_RANGE_MR];
+ unsigned long ret = 0;
+ int nr_range, i;
+
+ pr_info("init_memory_mapping: [mem %#010lx-%#010lx]\n",
+ start, end - 1);
+
+ memset(mr, 0, sizeof(mr));
+ nr_range = 0;
+ nr_range = split_mem_range(mr, nr_range, start, end);
+
/*
* Find space for the kernel direct mapping tables.
*
--
1.7.7
next prev parent reply other threads:[~2012-08-30 23:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 19:04 [PATCH V5 0/6] x86: Create direct mappings for E820_RAM only Jacob Shin
2012-08-29 19:04 ` [PATCH 1/6] x86, mm: Add page_size_mask() Jacob Shin
2012-08-29 19:04 ` [PATCH 2/6] x86, mm: Split out split_mem_range Jacob Shin
2012-08-29 19:04 ` [PATCH 3/6] x86/mm: find_early_table_space based on memory ranges that are being mapped Jacob Shin
2012-08-29 19:04 ` [PATCH 4/6] x86: Only direct map addresses that are marked as E820_RAM Jacob Shin
2012-08-29 21:17 ` Yinghai Lu
2012-08-29 21:32 ` Borislav Petkov
2012-08-30 6:28 ` H. Peter Anvin
2012-08-30 23:06 ` [PATCH 0/8] x86, mm: init_memory_mapping cleanup Yinghai Lu
2012-08-30 23:06 ` [PATCH 1/8] x86, mm: Add global page_size_mask Yinghai Lu
2012-08-30 23:06 ` Yinghai Lu [this message]
2012-08-30 23:06 ` [PATCH 3/8] x86, mm: Moving init_memory_mapping calling Yinghai Lu
2012-08-30 23:06 ` [PATCH 4/8] x86, mm: Revert back good_end setting for 64bit Yinghai Lu
2012-08-30 23:06 ` [PATCH 5/8] x86, mm: Find early page table only one time Yinghai Lu
2012-08-30 23:06 ` [PATCH 6/8] x86: if kernel .text .data .bss are not marked as E820_RAM, complain and fix Yinghai Lu
2012-08-30 23:06 ` [PATCH 7/8] x86: Fixup code testing if a pfn is direct mapped Yinghai Lu
2012-08-30 23:06 ` [PATCH 8/8] x86: Only direct map addresses that are marked as E820_RAM Yinghai Lu
2012-08-30 23:14 ` [PATCH 0/8] x86, mm: init_memory_mapping cleanup Yinghai Lu
2012-08-30 23:22 ` Jacob Shin
2012-08-29 21:46 ` [PATCH 4/6] x86: Only direct map addresses that are marked as E820_RAM Jacob Shin
2012-08-29 19:04 ` [PATCH 5/6] x86: Fixup code testing if a pfn is direct mapped Jacob Shin
2012-08-29 21:02 ` Yinghai Lu
2012-08-29 19:04 ` [PATCH 6/6] x86: if kernel .text .data .bss are not marked as E820_RAM, complain and fix Jacob Shin
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=1346367975-6446-3-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=hpa@zytor.com \
--cc=jacob.shin@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=tj@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