[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190630075650.8516-2-lpf.vector@gmail.com>
Date: Sun, 30 Jun 2019 15:56:46 +0800
From: Pengfei Li <lpf.vector@...il.com>
To: akpm@...ux-foundation.org, peterz@...radead.org, urezki@...il.com
Cc: rpenyaev@...e.de, mhocko@...e.com, guro@...com,
aryabinin@...tuozzo.com, rppt@...ux.ibm.com, mingo@...nel.org,
rick.p.edgecombe@...el.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Pengfei Li <lpf.vector@...il.com>
Subject: [PATCH 1/5] mm/vmalloc.c: Introduce a wrapper function of insert_vmap_area()
The red-black tree whose root is vmap_area_root is called the
*BUSY* tree. Since function insert_vmap_area() is only used to
add vmap area to the *BUSY* tree, so add wrapper functions
insert_va_to_busy_tree for readability.
Besides, rename insert_vmap_area to __insert_vmap_area to indicate
that it should not be called directly.
Signed-off-by: Pengfei Li <lpf.vector@...il.com>
---
mm/vmalloc.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0f76cca32a1c..0a46be76c63b 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -641,7 +641,7 @@ augment_tree_propagate_from(struct vmap_area *va)
}
static void
-insert_vmap_area(struct vmap_area *va,
+__insert_vmap_area(struct vmap_area *va,
struct rb_root *root, struct list_head *head)
{
struct rb_node **link;
@@ -651,6 +651,12 @@ insert_vmap_area(struct vmap_area *va,
link_va(va, root, parent, link, head);
}
+static __always_inline void
+insert_va_to_busy_tree(struct vmap_area *va)
+{
+ __insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
+}
+
static void
insert_vmap_area_augment(struct vmap_area *va,
struct rb_node *from, struct rb_root *root,
@@ -1070,7 +1076,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
va->va_start = addr;
va->va_end = addr + size;
va->flags = 0;
- insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
+ insert_va_to_busy_tree(va);
spin_unlock(&vmap_area_lock);
@@ -1871,7 +1877,7 @@ void __init vmalloc_init(void)
va->va_start = (unsigned long)tmp->addr;
va->va_end = va->va_start + tmp->size;
va->vm = tmp;
- insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
+ insert_va_to_busy_tree(va);
}
/*
@@ -3281,7 +3287,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
va->va_start = start;
va->va_end = start + size;
- insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
+ insert_va_to_busy_tree(va);
}
spin_unlock(&vmap_area_lock);
--
2.21.0
Powered by blists - more mailing lists