* Why the kernel needs `split_mem_range` to split the physical address range?
@ 2018-04-01 7:01 Hao Lee
2018-04-01 13:06 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Hao Lee @ 2018-04-01 7:01 UTC (permalink / raw)
To: linux-mm
Hi,
I'm currently studying the memory management subsystem. When I read
the code of x86_64 memory mapping initialization, I encounter a
problem and can't find answers on Google.
I wonder why the kernel needs `split_mem_range()`[0] to split physical
address range. To make this question clear, I find an example from
dmesg. The arguments of `split_mem_range` are start=0x00100000,
end=0x80000000. The splitting result is:
[mem 0x00100000-0x001FFFFF] page 4k
[mem 0x00200000-0x7FFFFFFF] page 2M
I don't know why the first 1MiB range is separated out to use 4k page
frame. I think these two ranges can be merged and let the range
[0x00100000-0x7FFFFFFF] use 2M page frame completely. I can't
understand the purpose of this range splitting. Could someone please
explain this function to me? Many Thanks!
[0] https://github.com/torvalds/linux/blob/10b84daddbec72c6b440216a69de9a9605127f7a/arch/x86/mm/init.c#L325
Regards,
Hao Lee
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Why the kernel needs `split_mem_range` to split the physical address range?
2018-04-01 7:01 Why the kernel needs `split_mem_range` to split the physical address range? Hao Lee
@ 2018-04-01 13:06 ` Matthew Wilcox
2018-04-02 11:25 ` Hao Lee
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2018-04-01 13:06 UTC (permalink / raw)
To: Hao Lee; +Cc: linux-mm
On Sun, Apr 01, 2018 at 03:01:13PM +0800, Hao Lee wrote:
> I wonder why the kernel needs `split_mem_range()`[0] to split physical
> address range. To make this question clear, I find an example from
> dmesg. The arguments of `split_mem_range` are start=0x00100000,
> end=0x80000000. The splitting result is:
>
> [mem 0x00100000-0x001FFFFF] page 4k
> [mem 0x00200000-0x7FFFFFFF] page 2M
>
> I don't know why the first 1MiB range is separated out to use 4k page
> frame. I think these two ranges can be merged and let the range
> [0x00100000-0x7FFFFFFF] use 2M page frame completely. I can't
> understand the purpose of this range splitting. Could someone please
> explain this function to me? Many Thanks!
2MB pages have to be 2MB aligned. If you want to use the memory between
1MB and 2MB, but not the memory between 0MB and 1MB, you must split the
first 2MB range into 4kB pages.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Why the kernel needs `split_mem_range` to split the physical address range?
2018-04-01 13:06 ` Matthew Wilcox
@ 2018-04-02 11:25 ` Hao Lee
0 siblings, 0 replies; 3+ messages in thread
From: Hao Lee @ 2018-04-02 11:25 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-mm
Hi, Matthew
Many thanks for your prompt reply. Your explanation is very clear and
easy to understand. It helps me a lot!
Regards,
Hao Lee
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-02 11:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01 7:01 Why the kernel needs `split_mem_range` to split the physical address range? Hao Lee
2018-04-01 13:06 ` Matthew Wilcox
2018-04-02 11:25 ` Hao Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox