summaryrefslogtreecommitdiffstats
path: root/lib/md5.c
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2012-10-09 01:30:42 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 09:22:33 +0200
commit1f0528653e41ec230c60f5738820e8a544731399 (patch)
treef07f4eb1ed58122b810b586839833e0c015b681c /lib/md5.c
parentrbtree: performance and correctness test (diff)
downloadlinux-1f0528653e41ec230c60f5738820e8a544731399.tar.xz
linux-1f0528653e41ec230c60f5738820e8a544731399.zip
rbtree: break out of rb_insert_color loop after tree rotation
It is a well known property of rbtrees that insertion never requires more than two tree rotations. In our implementation, after one loop iteration identified one or two necessary tree rotations, we would iterate and look for more. However at that point the node's parent would always be black, which would cause us to exit the loop. We can make the code flow more obvious by just adding a break statement after the tree rotations, where we know we are done. Additionally, in the cases where two tree rotations are necessary, we don't have to update the 'node' pointer as it wouldn't be used until the next loop iteration, which we now avoid due to this break statement. Signed-off-by: Michel Lespinasse <walken@google.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Acked-by: David Woodhouse <David.Woodhouse@intel.com> Cc: Rik van Riel <riel@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Daniel Santos <daniel.santos@pobox.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/md5.c')
0 files changed, 0 insertions, 0 deletions