From: Peter Zijlstra <peterz@infradead.org>
To: Michel Lespinasse <walken@google.com>
Cc: linux-kernel@vger.kernel.org, dave@stgolabs.net,
mingo@kernel.org, tglx@linutronix.de, oleg@redhat.com,
irogers@google.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org
Subject: Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers
Date: Thu, 30 Apr 2020 11:26:48 +0200 [thread overview]
Message-ID: <20200430092648.GB13616@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200430084617.GQ13592@hirez.programming.kicks-ass.net>
On Thu, Apr 30, 2020 at 10:46:17AM +0200, Peter Zijlstra wrote:
> On Wed, Apr 29, 2020 at 06:04:05PM -0700, Michel Lespinasse wrote:
> > - Have you considered passing a cmp() function to rb_add() and
> > rb_add_cached(), and having these test cmp() < 0 rather than less() ?
> > I figure every user will need to have a cmp() function, so it'd be
> > nicer if they didn't also need a less() function, if the generated
> > code is similar (if you checked and rejected it because of bad code,
> > please just say so).
>
> I did consider it; in fact I my original helpers had that.
>
> The reaosn I went with less() over cmp() is that the add() vs find()
> function signatures:
>
> bool (*less)(struct rb_node *, const struct rb_node *);
> int (*cmp)(const void *, const struct rb_node *);
>
> differ anyway in the left-hand argument; this is 'fixable' when you
> use an (on-stack) dummy object for find (as uprobes does), but that
> doesn't always work, esp. when the object is big. And given you need two
> functions anyway, I figured it was useful to name them differently.
>
> If you've looked at the other patches a bit, you'll see I've implemented
> both functions as 'trivial' wrappers around a single compare function in
> many cases.
I just realized I'd already done all this at some point ;-) See
rbtree_latch.h. Clearly I failed to realize the full potential back when
I did that.
next prev parent reply other threads:[~2020-04-30 9:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 15:32 [RFC][PATCH 0/7] Generic RB-tree helpers Peter Zijlstra
2020-04-29 15:32 ` [RFC][PATCH 1/7] rbtree: Add generic add and find helpers Peter Zijlstra
2020-04-30 1:04 ` Michel Lespinasse
2020-04-30 8:46 ` Peter Zijlstra
2020-04-30 9:26 ` Peter Zijlstra [this message]
2020-04-30 7:28 ` Juri Lelli
2020-04-30 7:51 ` Michel Lespinasse
2020-04-30 8:07 ` Juri Lelli
2020-04-30 8:27 ` Peter Zijlstra
2020-04-29 15:33 ` [RFC][PATCH 2/7] rbtree, sched/fair: Use rb_add_cached() Peter Zijlstra
2020-04-29 15:33 ` [RFC][PATCH 3/7] rbtree, sched/deadline: " Peter Zijlstra
2020-04-29 15:33 ` [RFC][PATCH 4/7] rbtree, perf: Use new rbtree helpers Peter Zijlstra
2020-04-29 15:33 ` [RFC][PATCH 5/7] rbtree, uprobes: Use " Peter Zijlstra
2020-04-29 15:33 ` [RFC][PATCH 6/7] rbtree, rtmutex: Use rb_add_cached() Peter Zijlstra
2020-04-29 15:33 ` [RFC][PATCH 7/7] rbtree, timerqueue: " Peter Zijlstra
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=20200430092648.GB13616@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave@stgolabs.net \
--cc=irogers@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=walken@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
all inboxes | Powered by JetHome®