Skip to content

Commit 6a9930b

Browse files
Davidlohr BuesoIngo Molnar
authored andcommitted
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: Davidlohr Bueso <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 8d04a5f commit 6a9930b

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

arch/x86/mm/pat_rbtree.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ enum {
5252
MEMTYPE_END_MATCH = 1
5353
};
5454

55-
static struct memtype *memtype_match(struct rb_root_cached *root,
56-
u64 start, u64 end, int match_type)
55+
static struct memtype *memtype_match(u64 start, u64 end, int match_type)
5756
{
5857
struct memtype *match;
5958

60-
match = memtype_interval_iter_first(root, start, end);
59+
match = memtype_interval_iter_first(&memtype_rbroot, start, end);
6160
while (match != NULL && match->start < end) {
6261
if ((match_type == MEMTYPE_EXACT_MATCH) &&
6362
(match->start == start) && (match->end == end))
@@ -73,10 +72,9 @@ static struct memtype *memtype_match(struct rb_root_cached *root,
7372
return NULL; /* Returns NULL if there is no match */
7473
}
7574

76-
static int memtype_rb_check_conflict(struct rb_root_cached *root,
77-
u64 start, u64 end,
78-
enum page_cache_mode reqtype,
79-
enum page_cache_mode *newtype)
75+
static int memtype_check_conflict(u64 start, u64 end,
76+
enum page_cache_mode reqtype,
77+
enum page_cache_mode *newtype)
8078
{
8179
struct memtype *match;
8280
enum page_cache_mode found_type = reqtype;
@@ -116,8 +114,7 @@ int rbt_memtype_check_insert(struct memtype *new,
116114
{
117115
int err = 0;
118116

119-
err = memtype_rb_check_conflict(&memtype_rbroot, new->start, new->end,
120-
new->type, ret_type);
117+
err = memtype_check_conflict(new->start, new->end, new->type, ret_type);
121118
if (err)
122119
return err;
123120

@@ -139,11 +136,9 @@ struct memtype *rbt_memtype_erase(u64 start, u64 end)
139136
* it then checks with END_MATCH, i.e. shrink the size of a node
140137
* from the end for the mremap case.
141138
*/
142-
data = memtype_match(&memtype_rbroot, start, end,
143-
MEMTYPE_EXACT_MATCH);
139+
data = memtype_match(start, end, MEMTYPE_EXACT_MATCH);
144140
if (!data) {
145-
data = memtype_match(&memtype_rbroot, start, end,
146-
MEMTYPE_END_MATCH);
141+
data = memtype_match(start, end, MEMTYPE_END_MATCH);
147142
if (!data)
148143
return ERR_PTR(-EINVAL);
149144
}

0 commit comments

Comments
 (0)