[PATCH 0/6] x86, mm: refine split_mem_range a little

Wei Yang
2019-02-12T02:12:53Z

split_mem_range is used to prepare range before mapping kernel page table.
Here are some patches to refine it.

Patch [1-2] are trivial clean up.
Patch [3] add some comment to illustrate the split process and prepare for
following refine work.
Patch [4-6] are the interesting refine.

There are totally 3 kinds of ranges, while 1G range is only valid on x86_64.
Because of this, the code needs to handle two different configurations. The
conditional macro makes it a little difficult to understand the logic.

We could simplify the logic with a different perception of those ranges, this
is done in Patch [4]. The change is a little, while the result is neat and
clean.

After this, the refreshed code shows we could skip some redundant work when
the range doesn't span PMD or PUD. This is in Patch [4-5].

Wei Yang (6):
x86, mm: remove second argument of split_mem_range()
x86, mm: remove check in save_mr
x86, mm: add comment for split_mem_range to help understanding
x86, mm: make split_mem_range() more easy to read
x86, mm: skip 1G range if the range doesn't span PUD
x86, mm: x86, mm: jump to split only 4K range when range doesn't span
PMD

arch/x86/mm/init.c | 87 ++++++++++++++++++++++++++++++++--------------
1 file changed, 61 insertions(+), 26 deletions(-)

--
2.19.1