lkml.org 
[lkml]   [2015]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/44] kdbus: Add comment on merging free pool slices
Date
Add comment on why we remove the same slice from free slices tree and
then add it back again when merging the slice to be released with
previous free slice.

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
---
ipc/kdbus/pool.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/ipc/kdbus/pool.c b/ipc/kdbus/pool.c
index 84afe96fbc22..c26ef963d8d1 100644
--- a/ipc/kdbus/pool.c
+++ b/ipc/kdbus/pool.c
@@ -304,6 +304,12 @@ static void __kdbus_pool_slice_release(struct kdbus_pool_slice *slice)
s = list_entry(slice->entry.prev,
struct kdbus_pool_slice, entry);
if (s->free) {
+ /*
+ * As size of slice increases after merge and free
+ * slices tree is ordered by slice size, we have to
+ * remove the slice from free slices tree and then add
+ * it again to keep the tree balanced.
+ */
rb_erase(&s->rb_node, &pool->slices_free);
list_del(&slice->entry);
s->size += slice->size;
--
1.8.3.1


\
 
 \ /
  Last update: 2015-10-08 13:41    [W:0.294 / U:1.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site