An article about mem split from LKML

http://article.gmane.org/gmane.linux.kernel/366072/match=2g+memory+split
On Tue, 10 Jan 2006, Jens Axboe wrote:
> 
> A newer version, trying to cater to the various comments in here.
> Changes:

Can we do one final cleanup? Do all the magic in _one_ place, namely the 
x86 Kconfig file.

Also, I don't think the NOHIGHMEM dependency is necessarily correct. A 
2G/2G split can be advantageous with a 16GB setup (you'll have more room 
for dentries etc), but you obviously want to have HIGHMEM for that..

Do it something like this:

	choice
		depends on EXPERIMENTAL
		prompt "Memory split"
		default DEFAULT_3G
		help
		  Select the wanted split between kernel and user memory.
		  If the address range available to the kernel is less than the
		  physical memory installed, the remaining memory will be available
		  as "high memory". Accessing high memory is a little more costly
		  than low memory, as it needs to be mapped into the kernel first.
		  Note that selecting anything but the default 3G/1G split will make
		  your kernel incompatible with binary only modules.

		config DEFAULT_3G
			bool "3G/1G user/kernel split"
		config DEFAULT_3G_OPT
			bool "3G/1G user/kernel split (for full 1G low memory)"
		config DEFAULT_2G
			bool "2G/2G user/kernel split"
		config DEFAULT_1G
			bool "1G/3G user/kernel split"
	endchoice

	config PAGE_OFFSET
		hex
		default 0xC0000000
		default 0xB0000000 if DEFAULT_3G_OPT
		default 0x78000000 if DEFAULT_2G
		default 0x40000000 if DEFAULT_1G

and then asm-i386/page.h can just do

	#define __PAGE_OFFSET ((unsigned long)CONFIG_PAGE_OFFSET)

and you're done.

If you ever want to change the offsets, you're only changing the Kconfig 
file, and as you can tell, the syntax is actually much _nicer_ that using 
the C preprocessor, since these kinds of choices is exactly what the 
Kconfig language is all about.

Please?

		Linus
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值