linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Matthew Wilcox <willy@infradead.org>,
	Nicholas Piggin <npiggin@gmail.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>
Subject: [PATCH 4/5] mm/vmalloc: Extend __find_vmap_area() with one more argument
Date: Tue,  7 Jun 2022 11:34:48 +0200	[thread overview]
Message-ID: <20220607093449.3100-5-urezki@gmail.com> (raw)
In-Reply-To: <20220607093449.3100-1-urezki@gmail.com>

__find_vmap_area() finds a "vmap_area" based on passed address.
It scan the specific "vmap_area_root" rb-tree. Extend the function
with one extra argument, so any tree can be specified where the
search has to be done.

There is no functional change as a result of this patch.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
 mm/vmalloc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 82771e555273..b60385101897 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -814,9 +814,9 @@ static struct vmap_area *find_vmap_area_exceed_addr(unsigned long addr)
 	return va;
 }
 
-static struct vmap_area *__find_vmap_area(unsigned long addr)
+static struct vmap_area *__find_vmap_area(unsigned long addr, struct rb_root *root)
 {
-	struct rb_node *n = vmap_area_root.rb_node;
+	struct rb_node *n = root->rb_node;
 
 	addr = (unsigned long)kasan_reset_tag((void *)addr);
 
@@ -1840,7 +1840,7 @@ static struct vmap_area *find_vmap_area(unsigned long addr)
 	struct vmap_area *va;
 
 	spin_lock(&vmap_area_lock);
-	va = __find_vmap_area(addr);
+	va = __find_vmap_area(addr, &vmap_area_root);
 	spin_unlock(&vmap_area_lock);
 
 	return va;
@@ -2582,7 +2582,7 @@ struct vm_struct *remove_vm_area(const void *addr)
 	might_sleep();
 
 	spin_lock(&vmap_area_lock);
-	va = __find_vmap_area((unsigned long)addr);
+	va = __find_vmap_area((unsigned long)addr, &vmap_area_root);
 	if (va && va->vm) {
 		struct vm_struct *vm = va->vm;
 
-- 
2.30.2



  parent reply	other threads:[~2022-06-07  9:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  9:34 [PATCH 0/5] Reduce a vmalloc internal lock contention preparation work Uladzislau Rezki (Sony)
2022-06-07  9:34 ` [PATCH 1/5] mm/vmalloc: Make link_va()/unlink_va() common to different rb_root Uladzislau Rezki (Sony)
2022-06-08  3:45   ` Baoquan He
2022-06-07  9:34 ` [PATCH 2/5] mm/vmalloc: Extend __alloc_vmap_area() with extra arguments Uladzislau Rezki (Sony)
2022-06-07  9:49   ` Christoph Hellwig
2022-06-07 13:02     ` Uladzislau Rezki
2022-06-10  8:18       ` Christoph Hellwig
2022-06-08  3:46   ` Baoquan He
2022-06-07  9:34 ` [PATCH 3/5] mm/vmalloc: Initialize VA's list node after unlink Uladzislau Rezki (Sony)
2022-06-08  3:19   ` Baoquan He
2022-06-09 12:36     ` Uladzislau Rezki
2022-06-09 13:30       ` Baoquan He
2022-06-09 13:53         ` Uladzislau Rezki
2022-06-07  9:34 ` Uladzislau Rezki (Sony) [this message]
2022-06-07  9:47   ` [PATCH 4/5] mm/vmalloc: Extend __find_vmap_area() with one more argument Christoph Hellwig
2022-06-07 13:03     ` Uladzislau Rezki
2022-06-08  3:47   ` Baoquan He
2022-06-07  9:34 ` [PATCH 5/5] lib/test_vmalloc: Switch to prandom_u32() Uladzislau Rezki (Sony)
2022-06-07 22:35 ` [PATCH 0/5] Reduce a vmalloc internal lock contention preparation work Andrew Morton
2022-06-08 10:05   ` Uladzislau Rezki

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=20220607093449.3100-5-urezki@gmail.com \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@gmail.com \
    --cc=oleksiy.avramchenko@sony.com \
    --cc=willy@infradead.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