mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -tip] rbtree: avoid func twice when node doesn't have a right sibling
@ 2010-07-13 10:30 Xiaotian Feng
  0 siblings, 0 replies; only message in thread
From: Xiaotian Feng @ 2010-07-13 10:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Xiaotian Feng, Suresh Siddha, Venkatesh Pallipadi, Ingo Molnar,
	Peter Zijlstra

In rb_augment_path(),

        if (node == parent->rb_left && parent->rb_right)
                func(parent->rb_right, data);
        else if (parent->rb_left)
                func(parent->rb_left, data);

If (node == parent->rb_left && !parent->rb_right), then kernel will
func(node,data) twice.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Venkatesh Pallipadi <venki@google.com>
Cc: Xiaotian Feng <dfeng@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 lib/rbtree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/rbtree.c b/lib/rbtree.c
index 4693f79..7bb8f7f 100644
--- a/lib/rbtree.c
+++ b/lib/rbtree.c
@@ -295,7 +295,7 @@ up:
 
 	if (node == parent->rb_left && parent->rb_right)
 		func(parent->rb_right, data);
-	else if (parent->rb_left)
+	else if (node == parent->rb_right && parent->rb_left)
 		func(parent->rb_left, data);
 
 	node = parent;
-- 
1.7.1.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-13 10:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-13 10:30 [PATCH -tip] rbtree: avoid func twice when node doesn't have a right sibling Xiaotian Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®