linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pengfei Li <lpf.vector@gmail.com>
To: akpm@linux-foundation.org, peterz@infradead.org, urezki@gmail.com
Cc: rpenyaev@suse.de, mhocko@suse.com, guro@fb.com,
	aryabinin@virtuozzo.com, rppt@linux.ibm.com, mingo@kernel.org,
	rick.p.edgecombe@intel.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Pengfei Li <lpf.vector@gmail.com>
Subject: [PATCH 2/5] mm/vmalloc.c: Introduce a wrapper function of insert_vmap_area_augment()
Date: Sun, 30 Jun 2019 15:56:47 +0800	[thread overview]
Message-ID: <20190630075650.8516-3-lpf.vector@gmail.com> (raw)
In-Reply-To: <20190630075650.8516-1-lpf.vector@gmail.com>

The red-black tree whose root is free_vmap_area_root is called the
*FREE* tree. Like the previous commit, add wrapper functions
insert_va_to_free_tree and rename insert_vmap_area_augment to
__insert_vmap_area_augment.

Signed-off-by: Pengfei Li <lpf.vector@gmail.com>
---
 mm/vmalloc.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0a46be76c63b..a5065fcb74d3 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -658,7 +658,7 @@ insert_va_to_busy_tree(struct vmap_area *va)
 }
 
 static void
-insert_vmap_area_augment(struct vmap_area *va,
+__insert_vmap_area_augment(struct vmap_area *va,
 	struct rb_node *from, struct rb_root *root,
 	struct list_head *head)
 {
@@ -674,6 +674,13 @@ insert_vmap_area_augment(struct vmap_area *va,
 	augment_tree_propagate_from(va);
 }
 
+static __always_inline void
+insert_va_to_free_tree(struct vmap_area *va, struct rb_node *from)
+{
+	__insert_vmap_area_augment(va, from, &free_vmap_area_root,
+				&free_vmap_area_list);
+}
+
 /*
  * Merge de-allocated chunk of VA memory with previous
  * and next free blocks. If coalesce is not done a new
@@ -979,8 +986,7 @@ adjust_va_to_fit_type(struct vmap_area *va,
 		augment_tree_propagate_from(va);
 
 		if (lva)	/* type == NE_FIT_TYPE */
-			insert_vmap_area_augment(lva, &va->rb_node,
-				&free_vmap_area_root, &free_vmap_area_list);
+			insert_va_to_free_tree(lva, &va->rb_node);
 	}
 
 	return 0;
@@ -1822,9 +1828,7 @@ static void vmap_init_free_space(void)
 				free->va_start = vmap_start;
 				free->va_end = busy->va_start;
 
-				insert_vmap_area_augment(free, NULL,
-					&free_vmap_area_root,
-						&free_vmap_area_list);
+				insert_va_to_free_tree(free, NULL);
 			}
 		}
 
@@ -1837,9 +1841,7 @@ static void vmap_init_free_space(void)
 			free->va_start = vmap_start;
 			free->va_end = vmap_end;
 
-			insert_vmap_area_augment(free, NULL,
-				&free_vmap_area_root,
-					&free_vmap_area_list);
+			insert_va_to_free_tree(free, NULL);
 		}
 	}
 }
-- 
2.21.0


  parent reply	other threads:[~2019-06-30  7:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-30  7:56 [PATCH 0/5] mm/vmalloc.c: improve readability and rewrite vmap_area Pengfei Li
2019-06-30  7:56 ` [PATCH 1/5] mm/vmalloc.c: Introduce a wrapper function of insert_vmap_area() Pengfei Li
2019-06-30  7:56 ` Pengfei Li [this message]
2019-06-30  7:56 ` [PATCH 3/5] mm/vmalloc.c: Rename function __find_vmap_area() for readability Pengfei Li
2019-07-02 12:23   ` Matthew Wilcox
2019-07-02 12:40     ` oddtux
2019-06-30  7:56 ` [PATCH 4/5] mm/vmalloc.c: Modify function merge_or_add_vmap_area() " Pengfei Li
2019-06-30  7:56 ` [PATCH 5/5] mm/vmalloc.c: Rewrite struct vmap_area to reduce its size Pengfei Li
2019-07-01  9:20 ` [PATCH 0/5] mm/vmalloc.c: improve readability and rewrite vmap_area Michal Hocko
2019-07-01 10:11   ` Uladzislau Rezki
2019-07-02 12:18     ` oddtux
2019-07-02 11:51   ` oddtux

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=20190630075650.8516-3-lpf.vector@gmail.com \
    --to=lpf.vector@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=guro@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rpenyaev@suse.de \
    --cc=rppt@linux.ibm.com \
    --cc=urezki@gmail.com \
    /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