make PAGE_OFFSET config option on x86
Subsystems (2)
PATCH 1/1 make PAGE_OFFSET config option on x86
Whether they're a user that is doing a scientific application that needs more than 3GB, or a large PAE machine that needs more ZONE_NORMAL, lots of people are applying patches to change PAGE_OFFSET. This patch lets you do it in a config option. It is a port from Andrea's 2.4 tree, and I believe that Ingo is the original author.
Andrea's patch didn't have a Config.help entry for this option, so I wrote one. I may not have all of the necessary context to explain it, so any comments there would be appreciated.
Signature · 2 lines
Dave Hansen [email protected]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.489 -> 1.491
# include/asm-i386/processor.h 1.28 -> 1.29
# arch/i386/Config.help 1.12 -> 1.13
# include/asm-i386/page.h 1.15 -> 1.16
# arch/i386/vmlinux.lds 1.9 -> (deleted)
# arch/i386/config.in 1.46 -> 1.47 # arch/i386/Makefile 1.16 -> 1.17 # Rules.make 1.68 -> 1.69 # mm/memory.c 1.83 -> 1.85 # (new) -> 1.1 arch/i386/vmlinux.lds.S # (new) -> 1.1 include/asm-i386/page_offset.h
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/08/19 haveblue@elm3b96.(none) 1.490
# merge Andrea's PAGE_OFFSET configuration option # -------------------------------------------- # 02/08/19 haveblue@elm3b96.(none) 1.491 # fix merge bug # # add Config.help entry # -------------------------------------------- # diff -Nru a/Rules.make b/Rules.make --- a/Rules.make Mon Aug 19 13:28:19 2002 +++ b/Rules.make Mon Aug 19 13:28:19 2002 @@ -149,12 +149,29 @@ # # Added the SMP separator to stop module accidents between uniprocessor # and SMP Intel boxes - AC - from bits by Michael Chastain +# Added separator for different PAGE_OFFSET memory models - Ingo. #
ifdef CONFIG_SMP
genksyms_smp_prefix := -p smp_
else
genksyms_smp_prefix :=
+endif
+
+ifdef CONFIG_2GB
+ifdef CONFIG_SMP
+ genksyms_smp_prefix := -p smp_2gig_
+else
+ genksyms_smp_prefix := -p 2gig_
+endif
+endif
+
+ifdef CONFIG_3GB
+ifdef CONFIG_SMP
+ genksyms_smp_prefix := -p smp_3gig_
+else
+ genksyms_smp_prefix := -p 3gig_
+endif
endif
# Don't include modversions.h, we're just about to generate it here.
arch/i386/Config.help +21 -0
@@ -128,6 +128,27 @@ If unsure, say "off". +CONFIG_1GB + On i386, a process can only virtually address 4GB of memory. This + lets you select how much of that virtual space you would like to + devoted to userspace, and how much to the kernel. + + Some userspace programs would like to address as much as possible and + have few demands of the kernel other than it get out of the way. These + users may opt to use the 3.5GB option to give their userspace program + as much room as possible. Due to alignment issues imposed by PAE, + the "3.5GB" option is unavailable if "64GB" high memory support is + enabled. + + Other users (especially those who use PAE) may be running out of + ZONE_NORMAL memory. Those users may benefit from increasing the + kernel's virtual address space size by taking it away from userspace, + which may not need all of its space. An indicator that this is + happening is when /proc/Meminfo's "LowFree:" is a small percentage of + "LowTotal:" while "HighFree:" is very large. + + If unsure, say "3GB" + CONFIG_HIGHPTE The VM uses one page table entry for each page of physical memory. For systems with a lot of RAM, this can be wasteful of precious
arch/i386/Makefile +4 -0
@@ -104,6 +104,9 @@ MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot +arch/i386/vmlinux.lds: arch/i386/vmlinux.lds.S FORCE + $(CPP) -C -P -I$(HPATH) -imacros $(HPATH)/asm-i386/page_offset.h -Ui386 arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds + vmlinux: arch/i386/vmlinux.lds .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
@@ -141,3 +144,4 @@ @$(MAKEBOOT) clean archmrproper: + rm -f arch/i386/vmlinux.lds
arch/i386/config.in +12 -2
@@ -186,14 +186,24 @@ 4GB CONFIG_HIGHMEM4G \ 64GB CONFIG_HIGHMEM64G" off -if [ "$CONFIG_HIGHMEM4G" = "y" ]; then +if [ "$CONFIG_HIGHMEM4G" = "y" -o "$CONFIG_HIGHMEM64G" = "y" ]; then define_bool CONFIG_HIGHMEM y fi if [ "$CONFIG_HIGHMEM64G" = "y" ]; then - define_bool CONFIG_HIGHMEM y define_bool CONFIG_X86_PAE y + choice 'User address space size' \ + "3GB CONFIG_1GB \ + 2GB CONFIG_2GB \ + 1GB CONFIG_3GB" 3GB +else + choice 'User address space size' \ + "3GB CONFIG_1GB \ + 2GB CONFIG_2GB \ + 1GB CONFIG_3GB \ + 3.5GB CONFIG_05GB" 3GB fi + bool 'Math emulation' CONFIG_MATH_EMULATION bool 'MTRR (Memory Type Range Register) support' CONFIG_MTRR
arch/i386/vmlinux.lds deleted +0 -101
101 lines not on this page · raw message
arch/i386/vmlinux.lds.S new file +101 -0
101 lines not on this page · raw message
include/asm-i386/page.h +3 -1
@@ -81,7 +81,9 @@* and CONFIG_HIGHMEM64G options in the kernel configuration. */ -#define __PAGE_OFFSET (0xC0000000) +#include <asm/page_offset.h> + +#define __PAGE_OFFSET (PAGE_OFFSET_RAW)/* * This much address space is reserved for vmalloc() and iomap()
include/asm-i386/page_offset.h new file +10 -0
@@ -0,0 +1,10 @@ +#include <linux/config.h> +#ifdef CONFIG_05GB +#define PAGE_OFFSET_RAW 0xE0000000 +#elif defined(CONFIG_1GB ) +#define PAGE_OFFSET_RAW 0xC0000000 +#elif defined(CONFIG_2GB ) +#define PAGE_OFFSET_RAW 0x80000000 +#elif defined(CONFIG_3GB ) +#define PAGE_OFFSET_RAW 0x40000000 +#endif
include/asm-i386/processor.h +4 -0
@@ -270,7 +270,11 @@/* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ +#ifndef CONFIG_05GB #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) +#else +#define TASK_UNMAPPED_BASE (TASK_SIZE / 16) +#endif /* * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
mm/memory.c +18 -5
@@ -97,8 +97,7 @@static inline void free_one_pgd (mmu_gather_t *tlb,pgd_t * dir) { -int j; -pmd_t * pmd; +pmd_t * pmd, * md, * emd;if (pgd_none (*dir))return ;
@@ -109,9 +108,23 @@ } pmd =pmd_offset (dir,0 );pgd_clear (dir); -for (j =0 ; j <PTRS_PER_PMD ; j++) { -prefetchw (pmd+j+(PREFETCH_STRIDE /16 )); -free_one_pmd (tlb, pmd+j); + +/* +* Beware if changing the loop below. It once used int j, +* for (j = 0; j < PTRS_PER_PMD; j++) +* free_one_pmd(pmd+j); +* but some older i386 compilers (e.g. egcs-2.91.66, gcc-2.95.3) +* terminated the loop with a _signed_ address comparison +* using "jle", when configured for HIGHMEM64GB (X86_PAE). +* If also configured for 3GB of kernel virtual address space, +* if page at physical 0x3ffff000 virtual 0x7ffff000 is used as +* a pmd, when that mm exits the loop goes on to free "entries" +* found at 0x80000000 onwards. The loop below compiles instead +* to be terminated by unsigned address comparison using "jb". +*/ +for (md = pmd, emd = pmd +PTRS_PER_PMD ; md < emd; md++) { +prefetchw (md+(PREFETCH_STRIDE /16 )); +free_one_pmd (tlb,md); }pmd_free_tlb (tlb, pmd); }