Re: Highmem emulation for 2.6?

From: Marc-Christian Petersen
Date: Sun Mar 07 2004 - 08:34:25 EST


On Sunday 07 March 2004 13:59, Pavel Machek wrote:

Hi Pavel,

> Does anyone have `subj`?
something like attached patch? Only for x86 now. Ontop of 2.6.4-rc1-mm2.

ciao, Marc
--- old/include/asm-i386/setup.h 2004-02-26 01:29:43.000000000 +0100
+++ 2.6.4-rc1-mm2/include/asm-i386/setup.h 2004-03-07 14:08:33.000000000 +0100
@@ -13,7 +13,21 @@
/*
* Reserved space for vmalloc and iomap - defined in asm/page.h
*/
+#ifdef CONFIG_HIGHMEM_EMULATION
+#define ORDER_DOWN(x) ((x >> (MAX_ORDER-1)) << (MAX_ORDER-1))
+#define MAXMEM_PFN \
+({ \
+ int __max_pfn; \
+ if (max_pfn > PFN_DOWN(MAXMEM)) \
+ __max_pfn = PFN_DOWN(MAXMEM); \
+ else \
+ __max_pfn = ORDER_DOWN(max_pfn / 5); \
+ __max_pfn; \
+)}
+#else
#define MAXMEM_PFN PFN_DOWN(MAXMEM)
+#endif
+
#define MAX_NONPAE_PFN (1 << 20)

/*
--- old/arch/i386/Kconfig 2004-03-05 17:16:45.000000000 +0100
+++ 2.6.4-rc1-mm2/arch/i386/Kconfig 2004-03-07 14:11:57.000000000 +0100
@@ -773,6 +773,19 @@ config X86_PAE
depends on HIGHMEM64G
default y

+config HIGHMEM_EMULATION
+ bool ' Emulate HIGHMEM on lowmem machines'
+ depends on HIGHMEM
+ default n
+ ---help---
+ Really obvious. With this option turned on and also selecting
+ High Memory Support (4GB||64GB) you can emulate HIGHMEM on lowmem
+ mashines. This does nothing usefull, nothing speed improvement
+ or anything else but helps you to debug HIGHMEM code on lowmem
+ mashines.
+
+ If unsure, say N.
+
# Common NUMA Features
config NUMA
bool "Numa Memory Allocation Support"