linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: mingo@kernel.org, tglx@linutronix.de, bp@alien8.de
Cc: peterz@infradead.org, x86@kernel.org, dave@stgolabs.net,
	linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: [PATCH 2/4] x86/mm, pat: Cleanup some of the local memtype_rb_* calls
Date: Wed, 20 Nov 2019 17:15:59 -0800	[thread overview]
Message-ID: <20191121011601.20611-3-dave@stgolabs.net> (raw)
In-Reply-To: <20191121011601.20611-1-dave@stgolabs.net>

Cleanup by both getting rid of passing the rb_root down the helper
calls; there is only one. Secondly rename some of the calls from
memtype_rb_*.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 arch/x86/mm/pat_rbtree.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
index c3d119cd155d..d31ca773d4bb 100644
--- a/arch/x86/mm/pat_rbtree.c
+++ b/arch/x86/mm/pat_rbtree.c
@@ -52,12 +52,11 @@ enum {
 	MEMTYPE_END_MATCH	= 1
 };
 
-static struct memtype *memtype_match(struct rb_root_cached *root,
-				     u64 start, u64 end, int match_type)
+static struct memtype *memtype_match(u64 start, u64 end, int match_type)
 {
 	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) {
 		if ((match_type == MEMTYPE_EXACT_MATCH) &&
 		    (match->start == start) && (match->end == end))
@@ -73,10 +72,9 @@ static struct memtype *memtype_match(struct rb_root_cached *root,
 	return NULL; /* Returns NULL if there is no match */
 }
 
-static int memtype_rb_check_conflict(struct rb_root_cached *root,
-				u64 start, u64 end,
-				enum page_cache_mode reqtype,
-				enum page_cache_mode *newtype)
+static int memtype_check_conflict(u64 start, u64 end,
+				  enum page_cache_mode reqtype,
+				  enum page_cache_mode *newtype)
 {
 	struct memtype *match;
 	enum page_cache_mode found_type = reqtype;
@@ -116,8 +114,7 @@ int rbt_memtype_check_insert(struct memtype *new,
 {
 	int err = 0;
 
-	err = memtype_rb_check_conflict(&memtype_rbroot, new->start, new->end,
-					new->type, ret_type);
+	err = memtype_check_conflict(new->start, new->end, new->type, ret_type);
 	if (err)
 		return err;
 
@@ -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
 	 * from the end for the mremap case.
 	 */
-	data = memtype_match(&memtype_rbroot, start, end,
-			     MEMTYPE_EXACT_MATCH);
+	data = memtype_match(start, end, MEMTYPE_EXACT_MATCH);
 	if (!data) {
-		data = memtype_match(&memtype_rbroot, start, end,
-				     MEMTYPE_END_MATCH);
+		data = memtype_match(start, end, MEMTYPE_END_MATCH);
 		if (!data)
 			return ERR_PTR(-EINVAL);
 	}
-- 
2.16.4


  parent reply	other threads:[~2019-11-21  1:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21  1:15 [PATCH -tip v3 0/4] x86,mm/pat: Move towards using generic interval tree Davidlohr Bueso
2019-11-21  1:15 ` [PATCH 1/4] x86/mm, pat: Convert pat tree to " Davidlohr Bueso
2019-11-21 16:42   ` [tip: x86/mm] x86/mm/pat: Convert the PAT tree to a " tip-bot2 for Davidlohr Bueso
2019-11-21 17:55   ` tip-bot2 for Davidlohr Bueso
2019-11-21  1:15 ` Davidlohr Bueso [this message]
2019-11-21 16:42   ` [tip: x86/mm] x86/mm/pat: Do not pass 'rb_root' down the memtype tree helper functions tip-bot2 for Davidlohr Bueso
2019-11-21 17:10   ` [PATCH 2/4] x86/mm, pat: Cleanup some of the local memtype_rb_* calls Ingo Molnar
2019-11-21 17:55   ` [tip: x86/mm] x86/mm/pat: Do not pass 'rb_root' down the memtype tree helper functions tip-bot2 for Davidlohr Bueso
2019-11-21  1:16 ` [PATCH 3/4] x86/mm, pat: Drop rbt prefix from external memtype calls Davidlohr Bueso
2019-11-21 16:42   ` [tip: x86/mm] x86/mm/pat: Drop the rbt_ " tip-bot2 for Davidlohr Bueso
2019-11-21 17:55   ` tip-bot2 for Davidlohr Bueso
2019-11-21  1:16 ` [PATCH 4/4] x86/mm, pat: Rename pat_rbtree.c to pat_interval.c Davidlohr Bueso
2019-11-21 16:42   ` [tip: x86/mm] x86/mm/pat: " tip-bot2 for Davidlohr Bueso
2019-11-21 17:55   ` tip-bot2 for Davidlohr Bueso
2019-11-21  5:57 ` [PATCH -tip v3 0/4] x86,mm/pat: Move towards using generic interval tree Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191121011601.20611-3-dave@stgolabs.net \
    --to=dave@stgolabs.net \
    --cc=bp@alien8.de \
    --cc=dbueso@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).