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

From: Wei Yang
Date: Mon Feb 11 2019 - 21:12:53 EST

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

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

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