public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Peter Zijlstra <peterz@infradead.org>
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 08:36:08 -0700	[thread overview]
Message-ID: <20170608153608.GA2464@linux-80c1.suse> (raw)
In-Reply-To: <20170608130328.dsljjblut2eew2kd@hirez.programming.kicks-ass.net>

On Thu, 08 Jun 2017, Peter Zijlstra wrote:

>On Mon, May 29, 2017 at 07:09:36PM -0700, Davidlohr Bueso wrote:
>>
>>  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?

I added that so that we can differentiate between regular rbtrees and the
cached flavor. However, you are right, we can avoid that arg considering
that the tree is never empty (this is an erase call), thus if leftmost
is nil, it was never cached in the first place.

Thanks,
Davidlohr

  reply	other threads:[~2017-06-08 15:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  2:09 [rfc PATCH -next 0/5] rbtree: Cache leftmost node internally Davidlohr Bueso
2017-05-30  2:09 ` [PATCH 1/5] " Davidlohr Bueso
2017-06-08 13:03   ` Peter Zijlstra
2017-06-08 15:36     ` Davidlohr Bueso [this message]
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=20170608153608.GA2464@linux-80c1.suse \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --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 \
    --cc=peterz@infradead.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