Page 1 of 1
Is good to use 4MB pages?
Posted: Mon May 19, 2008 2:21 pm
by AlfaOmega08
If I've 1GB of memory and if I use 4MB pages, I can only have 256 tasks (1024 / 4), if each task takes a page. With 4KB pages, I can have 262144 tasks (1024*1024 / 4), if each task takes a page. So why should I use 4MB page?
Posted: Mon May 19, 2008 2:26 pm
by edfed
it is possible to mix 4k, 2m and 4m pages.
4k for little files.
and 4m for big files
2m pages can be used for V86 modules.
Posted: Mon May 19, 2008 2:28 pm
by Korona
You could use 4-MB pages when a task needs much memory and 4-KB pages when it does not need much.
You can also use 4-MB pages for the kernel and 4-KB pages for userspace tasks.
Posted: Mon May 19, 2008 2:29 pm
by AlfaOmega08
setting and clearing the bit in CR4 when switching from kernel to user mode?
Posted: Mon May 19, 2008 2:39 pm
by Korona
CR4.PSE just activates PSE it does not force you to use it.
Posted: Mon May 19, 2008 4:18 pm
by AJ
Hi,
A reason stated in the Intel Manuals (sorry - I haven't got time to search and quote) is that there are different TLB entries for large and small pages.
This means that if you store you kernel in a 4M global page and everything else using 4K pages, there's no reason why you should get a TLB miss for your kernel.
Cheers,
Adam