From: Mel Gorman <mel@csn.ul.ie>
To: linux-mm@kvack.org
Cc: Mel Gorman <mel@csn.ul.ie>,
linux-kernel@vger.kernel.org, lhms-devel@lists.sourceforge.net
Subject: [PATCH 3/7] x86 - Specify amount of kernel memory at boot time
Date: Fri, 17 Feb 2006 14:16:52 +0000 (GMT) [thread overview]
Message-ID: <20060217141652.7621.62398.sendpatchset@skynet.csn.ul.ie> (raw)
In-Reply-To: <20060217141552.7621.74444.sendpatchset@skynet.csn.ul.ie>
This patch was originally written by Kamezawa Hiroyuki.
It should be possible for the administrator to specify at boot-time how much
memory should be used for the kernel and how much should go to ZONE_EASYRCLM.
After this patch is applied, the boot option kernelcore= can be used to
specify how much memory should be used by the kernel.
(Note that Kamezawa called this parameter coremem= . This was renamed because
of the way ppc64 parses command line arguments and would confuse coremem=
with mem=. The name was chosen that could be used across architectures)
The value of kernelcore is important. If it is too small, there will be more
pressure on ZONE_NORMAL and a potential loss of performance. If it is about
896MB, it means that ZONE_HIGHMEM will have a size of zero. Any differences in
tests will depend on whether CONFIG_HIGHPTE is set in the standard kernel or
not. With lots of memory, the ideal is to specify a kernelcore that gives
ZONE_NORMAL it's full size and a ZONE_HIGHMEM for PTEs. The right value
depends, like any tunable, on the workload.
It is also important to note that if kernelcore is less than the maximum
size of ZONE_NORMAL, GFP_HIGHMEM allocations will use ZONE_NORMAL, not the
reachable portion of ZONE_EASYRCLM.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.16-rc3-mm1-102_addzone/arch/i386/kernel/setup.c linux-2.6.16-rc3-mm1-103_x86coremem/arch/i386/kernel/setup.c
--- linux-2.6.16-rc3-mm1-102_addzone/arch/i386/kernel/setup.c 2006-02-16 09:50:41.000000000 +0000
+++ linux-2.6.16-rc3-mm1-103_x86coremem/arch/i386/kernel/setup.c 2006-02-17 09:42:45.000000000 +0000
@@ -112,6 +112,9 @@ int bootloader_type;
/* user-defined highmem size */
static unsigned int highmem_pages = -1;
+/* user-defined easy-reclaim-size */
+static unsigned int core_mem_pages = -1;
+static unsigned int easyrclm_pages = 0;
/*
* Setup options
*/
@@ -912,6 +915,15 @@ static void __init parse_cmdline_early (
*/
else if (!memcmp(from, "vmalloc=", 8))
__VMALLOC_RESERVE = memparse(from+8, &from);
+ /*
+ * kernelcore=size sets the amount of memory for use for
+ * kernel allocations that cannot be reclaimed easily.
+ * The remaining memory is set aside for easy reclaim
+ * for features like memory remove or huge page allocations
+ */
+ else if (!memcmp(from, "kernelcore=",11)) {
+ core_mem_pages = memparse(from+11, &from) >> PAGE_SHIFT;
+ }
next_char:
c = *(from++);
@@ -981,6 +993,17 @@ void __init find_max_pfn(void)
}
}
+unsigned long __init calculate_core_memory(unsigned long max_low_pfn)
+{
+ if (max_low_pfn < core_mem_pages) {
+ highmem_pages -= (core_mem_pages - max_low_pfn);
+ } else {
+ max_low_pfn = core_mem_pages;
+ highmem_pages = 0;
+ }
+ easyrclm_pages = max_pfn - core_mem_pages;
+ return max_low_pfn;
+}
/*
* Determine low and high memory ranges:
*/
@@ -1037,6 +1060,8 @@ unsigned long __init find_max_low_pfn(vo
printk(KERN_ERR "ignoring highmem size on non-highmem kernel!\n");
#endif
}
+ if (core_mem_pages != -1)
+ max_low_pfn = calculate_core_memory(max_low_pfn);
return max_low_pfn;
}
@@ -1157,7 +1182,8 @@ void __init zone_sizes_init(void)
zones_size[ZONE_DMA] = max_dma;
zones_size[ZONE_NORMAL] = low - max_dma;
#ifdef CONFIG_HIGHMEM
- zones_size[ZONE_HIGHMEM] = highend_pfn - low;
+ zones_size[ZONE_HIGHMEM] = highend_pfn - low - easyrclm_pages;
+ zones_size[ZONE_EASYRCLM] = easyrclm_pages;
#endif
}
free_area_init(zones_size);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-02-17 14:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-17 14:15 [PATCH 0/7] Reducing fragmentation using zones v5 Mel Gorman
2006-02-17 14:16 ` [PATCH 1/7] Add __GFP_EASYRCLM flag and update callers Mel Gorman
2006-02-17 14:16 ` [PATCH 2/7] Create the ZONE_EASYRCLM zone Mel Gorman
2006-02-17 14:16 ` Mel Gorman [this message]
2006-02-17 14:17 ` [PATCH 4/7] ppc64 - Specify amount of kernel memory at boot time Mel Gorman
2006-02-17 17:16 ` Dave Hansen
2006-02-17 19:03 ` Mel Gorman
2006-02-17 19:17 ` Dave Hansen
2006-02-17 19:36 ` Mel Gorman
2006-02-17 21:31 ` Joel Schopp
2006-02-21 14:51 ` Mel Gorman
2006-02-21 17:35 ` Dave Hansen
2006-02-22 16:43 ` Mel Gorman
2006-02-23 16:42 ` Dave Hansen
2006-02-23 17:19 ` Mel Gorman
2006-02-23 17:38 ` Dave Hansen
2006-02-23 18:01 ` Mel Gorman
2006-02-23 18:15 ` Dave Hansen
2006-02-24 0:15 ` KAMEZAWA Hiroyuki
2006-02-24 9:04 ` Mel Gorman
2006-02-23 17:40 ` Mike Kravetz
2006-02-17 14:17 ` [PATCH 5/7] At boot, determine what zone memory will hot-add to Mel Gorman
2006-02-17 14:17 ` [PATCH 6/7] Allow HugeTLB allocations to use ZONE_EASYRCLM Mel Gorman
2006-02-17 14:18 ` [PATCH 7/7] Add documentation for extra boot parameters Mel Gorman
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=20060217141652.7621.62398.sendpatchset@skynet.csn.ul.ie \
--to=mel@csn.ul.ie \
--cc=lhms-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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