All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: daniel.santos@pobox.com
Cc: Andrea Arcangeli <aarcange@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: Generic rbtree search & insert cores
Date: Tue, 01 May 2012 13:20:28 +0200	[thread overview]
Message-ID: <1335871228.13683.141.camel@twins> (raw)
In-Reply-To: <4F9E7365.2040907@att.net>

On Mon, 2012-04-30 at 06:11 -0500, Daniel Santos wrote:
> 
> So as long as our struct rbtree_relationship is a compile-time
> constant, the generated code will look pretty much (if not exactly)
> like that of the example code in rbtree.h.  Please let me know what
> you think.  I've tested this in a userspace program, but haven't fully
> stress tested it in kernelspace yet. 

Right, this ought to work.

I'm not sure the root_offset thing is worth it though, passing in the
rb_root pointer isn't much of a hassle, in fact I'd expect to pass rb
related pointers to a function called rbtree_insert().

Also, using a macro to create the rbtree_relationship thing would make
it easier. Something like:

	RB_RELATION(struct mouse, node, name, name_cmp);

I'd think you'd also want to provide an insertion variant that does the
leftmost thing, that's used in several places, and you'd also need one
for the augmented rb-tree.



  reply	other threads:[~2012-05-01 11:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 11:11 Generic rbtree search & insert cores Daniel Santos
2012-05-01 11:20 ` Peter Zijlstra [this message]
2012-05-01 16:00   ` Peter Zijlstra
2012-05-02  1:01     ` Daniel Santos
2012-05-04 21:52     ` Daniel Santos
2012-05-09 23:48       ` Request feedback please: generic rbtree search, insert & remove (with leftmost, augmented, etc.) Daniel Santos

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=1335871228.13683.141.camel@twins \
    --to=peterz@infradead.org \
    --cc=aarcange@redhat.com \
    --cc=daniel.santos@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.