From: David Woodhouse <dwmw2@infradead.org>
To: Zach Brown <zach.brown@oracle.com>
Cc: akpm@osdl.org, andrea@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Shrink rbtree
Date: Fri, 21 Apr 2006 20:06:52 +0100 [thread overview]
Message-ID: <1145646412.11909.218.camel@pmac.infradead.org> (raw)
In-Reply-To: <44492343.6040603@oracle.com>
On Fri, 2006-04-21 at 11:24 -0700, Zach Brown wrote:
> > the pointers are always going to be aligned. So let's just use the
> > lowest bit of the parent pointer instead. This shrinks the rb_node from
> > 4 machine-words to 3.
>
> We've seen this patch before, haven't we? :) I still like it.
Maybe. I thought I'd actually done it once before, but I couldn't
actually find it when I went looking. It should save about 40KiB of RAM
on my Nokia 770, because I should get 145 jffs2_node_frag objects in
each slab page instead of only 127 -- so yes, I like it too :)
> > Another pair of eyes on the 'remove dead code in rb_erase()' bit in
> > particular would be appreciated.
>
> I'll trade you some eyes for a description beyond the four words
> obvious, remove, dead, and code.
Plenty more words in the git commit. They don't make much sense without
the patch right below them, and you can see them in juxtaposition at
http://git.infradead.org/?p=users/dwmw2/rbtree-2.6.git;a=commitdiff;h=1975e59375756da4ff4e6e7d12f67485e813ace0
> > #define RB_RED 0
> > #define RB_BLACK 1
>
> > +#define rb_colour(r) ((r)->rb_parent_colour & 1)
>
> This creates a pretty strong bond between the two.. maybe a
> RB_COLOUR_MASK and use that and the _RED/_BLACK defines instead of the
> raw constants?
I think it's be better just to drop the RB_RED and RB_BLACK definitions.
> > +static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
> > +{
>
> BUG_ON((unsigned long)p & 3);
Yeah, I suppose we could.
> > @@ -131,8 +147,7 @@ extern void rb_replace_node(struct rb_no
> > static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
> > struct rb_node ** rb_link)
> > {
> > - node->rb_parent = parent;
> > - node->rb_color = RB_RED;
> > + node->rb_parent_colour = (unsigned long )parent;
>
> use rb_set_parent(node, parent) and get the assertion.
Que?
--
dwmw2
next prev parent reply other threads:[~2006-04-21 19:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 12:47 David Woodhouse
2006-04-21 13:06 ` Nick Piggin
2006-04-21 19:08 ` David Woodhouse
2006-04-21 20:57 ` Hugh Dickins
2006-04-21 22:12 ` David Woodhouse
2006-04-23 13:03 ` Hugh Dickins
2006-04-21 18:24 ` Zach Brown
2006-04-21 19:06 ` David Woodhouse [this message]
2006-04-21 19:25 ` Zach Brown
2006-04-22 1:09 ` Andrew Morton
2006-04-22 1:10 ` Andrew Morton
2006-04-22 1:21 ` Andrew Morton
2006-04-22 1:29 ` David Woodhouse
2006-04-22 12:29 ` Ingo Oeser
2006-04-22 13:38 ` David Woodhouse
2006-04-22 22:55 ` Ingo Oeser
2006-04-23 16:36 ` Steven Rostedt
2006-04-23 17:20 ` Thomas Gleixner
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=1145646412.11909.218.camel@pmac.infradead.org \
--to=dwmw2@infradead.org \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=zach.brown@oracle.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
all inboxes | Powered by JetHome®