mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Venkatesh Pallipadi <venki@google.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-tip-commits@vger.kernel.org" 
	<linux-tip-commits@vger.kernel.org>,
	Fabio Checconi <fabio@gandalf.sssup.it>
Subject: Re: [PATCH] rbtree: undo augmented damage -v2
Date: Wed, 02 Jun 2010 14:11:14 -0700	[thread overview]
Message-ID: <1275513074.2913.258.camel@sbs-t61.sc.intel.com> (raw)
In-Reply-To: <1275417720.27810.28160.camel@twins>

On Tue, 2010-06-01 at 11:42 -0700, Peter Zijlstra wrote:
> On Tue, 2010-06-01 at 11:09 -0700, Venkatesh Pallipadi wrote:
> > On Tue, Jun 1, 2010 at 10:42 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> > > On Tue, 2010-06-01 at 10:34 -0700, Venkatesh Pallipadi wrote:
> > >>
> > >> Yes. This will cover all the cases on insert. But on erase, there is
> > >> still a case where a rotate of sibling node is done during the
> > >> re-coloration process. There we have a child change on sibling's
> > >> child. I am not able to think of any easy way to handle that case.
> > >
> > > Let me go draw some figures with pen and paper to match up the erase
> > > path with the rb_augment_erase_begin() code, because I can't quite spot
> > > the case we're missing.
> > >
> > > If you have it handy, ascii art might help..
> > 
> > It is this case
> > 
> >     P
> >    / \
> >   N   S
> >      / \
> >     SL SR
> > 
> > changing to
> > 
> >     P
> >    / \
> >   N  SL
> >       \
> >        S
> >         \
> >         SR
> 
> Right, but see: http://en.wikipedia.org/wiki/Red-black_tree
> That is delete_case5, however then we fall into delete_case6 and perform
> a left rotation.
> 
> So suppose we start with the tree:
> 
>     P                  P               P                SL
>   /   \               / \             / \               / \
>  D     S      -->    N  S      -->   N   SL     -->    P   S
>   \   / \              / \                \           /     \
>    N SL  SR          SL* SR                S*        N      SR
>                                             \
>                                              SR
> 
> and then remove D, delete case 5 and finally delete case 6, * marks red.
> 
> rb_augment_erase_begin(D) will return N, and then rb_augment_path(N)
> will re-augment: N, P, SL and S.


      P                       SL
    /  \                     /  \
   N    S       --->        N    S
  /   /  \                 /      \
 C   SL  SR               C        SR

If P needs to be removed, we need to re-augment S also in this case,
right? It looks like we are not handling this case.

thanks,
suresh




  parent reply	other threads:[~2010-06-02 21:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 19:57 [patch 0/3] x86: Use interval tree to keep track of PAT reserve/free venkatesh.pallipadi
2010-02-10 19:57 ` [patch 1/3] rbtree: Add support for augmented rbtrees venkatesh.pallipadi
2010-02-10 23:23   ` [patch 1/3] rbtree: Add support for augmented rbtrees (ver 2) Pallipadi, Venkatesh
2010-02-19  0:21     ` [tip:x86/pat] rbtree: Add support for augmented rbtrees tip-bot for Pallipadi, Venkatesh
2010-05-27 15:29       ` Peter Zijlstra
2010-05-29 12:29       ` [RFC][PATCH] rbtree: undo augmented damage Peter Zijlstra
2010-05-29 13:31         ` [PATCH] rbtree: undo augmented damage -v2 Peter Zijlstra
2010-06-01 17:00           ` Venkatesh Pallipadi
2010-06-01 17:19             ` Peter Zijlstra
2010-06-01 17:34               ` Peter Zijlstra
2010-06-01 17:34               ` Venkatesh Pallipadi
2010-06-01 17:42                 ` Peter Zijlstra
2010-06-01 18:09                   ` Venkatesh Pallipadi
2010-06-01 18:42                     ` Peter Zijlstra
2010-06-01 20:31                       ` Venkatesh Pallipadi
2010-06-02 21:11                       ` Suresh Siddha [this message]
2010-06-03  1:15                         ` Venkatesh Pallipadi
2010-06-03  7:13                         ` Peter Zijlstra
2010-06-03  7:48                           ` Peter Zijlstra
2010-06-03 16:04                             ` Suresh Siddha
2010-06-09 10:12                   ` [tip:x86/pat] rbtree: Undo augmented trees performance damage tip-bot for Peter Zijlstra
2010-07-05 12:48                   ` [tip:x86/urgent] rbtree: Undo augmented trees performance damage and regression tip-bot for Peter Zijlstra
2010-02-10 19:57 ` [patch 2/3] x86: Preparatory changes in pat.c for bigger rbtree change venkatesh.pallipadi
2010-02-19  0:22   ` [tip:x86/pat] x86, pat: " tip-bot for venkatesh.pallipadi@intel.com
2010-02-10 19:57 ` [patch 3/3] x86: Migrate to rbtree only backend for pat memtype management venkatesh.pallipadi
2010-02-10 23:26   ` [patch 3/3] x86: Migrate to rbtree only backend for pat memtype management (ver 2) Pallipadi, Venkatesh
2010-02-19  0:22     ` [tip:x86/pat] x86, pat: Migrate to rbtree only backend for pat memtype management tip-bot for Pallipadi, Venkatesh

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=1275513074.2913.258.camel@sbs-t61.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=fabio@gandalf.sssup.it \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=venki@google.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

Powered by JetHome