Commit 6a9930b1 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Ingo Molnar

x86/mm/pat: Do not pass 'rb_root' down the memtype tree helper functions

Get rid of the passing the rb_root down the helper calls; there
is only one: &memtype_rbroot.

No change in functionality.

[ mingo: Fixed the changelog which described a different version of the patch. ]
Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lkml.kernel.org/r/20191121011601.20611-3-dave@stgolabs.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 8d04a5f9
...@@ -52,12 +52,11 @@ enum { ...@@ -52,12 +52,11 @@ enum {
MEMTYPE_END_MATCH = 1 MEMTYPE_END_MATCH = 1
}; };
static struct memtype *memtype_match(struct rb_root_cached *root, static struct memtype *memtype_match(u64 start, u64 end, int match_type)
u64 start, u64 end, int match_type)
{ {
struct memtype *match; struct memtype *match;
match = memtype_interval_iter_first(root, start, end); match = memtype_interval_iter_first(&memtype_rbroot, start, end);
while (match != NULL && match->start < end) { while (match != NULL && match->start < end) {
if ((match_type == MEMTYPE_EXACT_MATCH) && if ((match_type == MEMTYPE_EXACT_MATCH) &&
(match->start == start) && (match->end == end)) (match->start == start) && (match->end == end))
...@@ -73,10 +72,9 @@ static struct memtype *memtype_match(struct rb_root_cached *root, ...@@ -73,10 +72,9 @@ static struct memtype *memtype_match(struct rb_root_cached *root,
return NULL; /* Returns NULL if there is no match */ return NULL; /* Returns NULL if there is no match */
} }
static int memtype_rb_check_conflict(struct rb_root_cached *root, static int memtype_check_conflict(u64 start, u64 end,
u64 start, u64 end, enum page_cache_mode reqtype,
enum page_cache_mode reqtype, enum page_cache_mode *newtype)
enum page_cache_mode *newtype)
{ {
struct memtype *match; struct memtype *match;
enum page_cache_mode found_type = reqtype; enum page_cache_mode found_type = reqtype;
...@@ -116,8 +114,7 @@ int rbt_memtype_check_insert(struct memtype *new, ...@@ -116,8 +114,7 @@ int rbt_memtype_check_insert(struct memtype *new,
{ {
int err = 0; int err = 0;
err = memtype_rb_check_conflict(&memtype_rbroot, new->start, new->end, err = memtype_check_conflict(new->start, new->end, new->type, ret_type);
new->type, ret_type);
if (err) if (err)
return err; return err;
...@@ -139,11 +136,9 @@ struct memtype *rbt_memtype_erase(u64 start, u64 end) ...@@ -139,11 +136,9 @@ struct memtype *rbt_memtype_erase(u64 start, u64 end)
* it then checks with END_MATCH, i.e. shrink the size of a node * it then checks with END_MATCH, i.e. shrink the size of a node
* from the end for the mremap case. * from the end for the mremap case.
*/ */
data = memtype_match(&memtype_rbroot, start, end, data = memtype_match(start, end, MEMTYPE_EXACT_MATCH);
MEMTYPE_EXACT_MATCH);
if (!data) { if (!data) {
data = memtype_match(&memtype_rbroot, start, end, data = memtype_match(start, end, MEMTYPE_END_MATCH);
MEMTYPE_END_MATCH);
if (!data) if (!data)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment