From: Peter Zijlstra <peterz@infradead.org>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: mingo@kernel.org, akpm@linux-foundation.org, jack@suse.cz,
kirill.shutemov@linux.intel.com, ldufour@linux.vnet.ibm.com,
mhocko@suse.com, mgorman@techsingularity.net,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH 1/5] rbtree: Cache leftmost node internally
Date: Thu, 8 Jun 2017 15:03:28 +0200 [thread overview]
Message-ID: <20170608130328.dsljjblut2eew2kd@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20170530020940.7918-2-dave@stgolabs.net>
On Mon, May 29, 2017 at 07:09:36PM -0700, Davidlohr Bueso wrote:
> diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
> index 9702b6e183bc..b84ee26c19d9 100644
> --- a/include/linux/rbtree_augmented.h
> +++ b/include/linux/rbtree_augmented.h
> @@ -41,7 +41,9 @@ struct rb_augment_callbacks {
> void (*rotate)(struct rb_node *old, struct rb_node *new);
> };
>
> -extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
> +extern void __rb_insert_augmented(struct rb_node *node,
> + struct rb_root *root,
> + bool newleft, struct rb_node **leftmost,
> void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
> /*
> * Fixup the rbtree and update the augmented information when rebalancing.
> @@ -150,6 +161,7 @@ extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
>
> static __always_inline struct rb_node *
> __rb_erase_augmented(struct rb_node *node, struct rb_root *root,
> + bool cached, struct rb_node **leftmost,
> const struct rb_augment_callbacks *augment)
> {
> struct rb_node *child = node->rb_right;
> @@ -157,6 +169,9 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root,
> struct rb_node *parent, *rebalance;
> unsigned long pc;
>
> + if (cached && node == *leftmost)
> + *leftmost = rb_next(node);
> +
> if (!tmp) {
> /*
> * Case 1: node to erase has no more than 1 child (easy!)
Why do we have @cached ? Wouldn't simply testing @leftmost for NULL not
do the same?
next prev parent reply other threads:[~2017-06-08 13:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 2:09 [rfc PATCH -next 0/5] " Davidlohr Bueso
2017-05-30 2:09 ` [PATCH 1/5] " Davidlohr Bueso
2017-06-08 13:03 ` Peter Zijlstra [this message]
2017-06-08 15:36 ` Davidlohr Bueso
2017-05-30 2:09 ` [PATCH 2/5] sched/fair: Replace cfs_rq->rb_leftmost Davidlohr Bueso
2017-05-30 2:09 ` [PATCH 3/5] locking/rtmutex: Replace top-waiter and pi_waiters leftmost caching Davidlohr Bueso
2017-05-30 2:09 ` [PATCH 4/5] sched/deadline: Replace earliest deadline and runqueue " Davidlohr Bueso
2017-05-30 2:09 ` [PATCH 5/5] lib/interval_tree: Fast overlap detection Davidlohr Bueso
2017-05-30 4:54 ` kbuild test robot
2017-05-30 15:44 ` Davidlohr Bueso
2017-06-07 15:05 ` [rfc PATCH -next 0/5] rbtree: Cache leftmost node internally Davidlohr Bueso
2017-06-08 13:42 ` 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=20170608130328.dsljjblut2eew2kd@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=ldufour@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=mingo@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 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®