Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1662529

Re: [PATCH 1/8] rbtree: Cache leftmost node internally

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [PATCH 1/8] rbtree: Cache leftmost node internally
Date 2017-06-09 16:40 +0200
Message-ID <tQteW-2JK-23@gated-at.bofh.it> (permalink)
References <tQa2C-7DP-3@gated-at.bofh.it> <tQa2C-7DP-9@gated-at.bofh.it> <tQmQa-78W-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 09 Jun 2017, Jan Kara wrote:
>
>Looks good to me. Just one nit below:

Thanks for having a look!

>
>> @@ -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,
>> +		     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 (leftmost && node == *leftmost)
>> +		*leftmost = rb_next(node);
>> +
>>  	if (!tmp) {
>>  		/*
>>  		 * Case 1: node to erase has no more than 1 child (easy!)
>
>Why do you propagate e.g. 'leftmost' down to __rb_erase_augmented() when
>you could just handle everything within rb_erase_augmented_cached?
>Similarly for other functions like __rb_insert()... It would seem like less
>churn and I don't see downside to it...

I propagate args so we don't have to duplicate the checks between the regular
and augmented rbtrees.

Thanks,
Davidlohr

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH -next v2 0/8] rbtree: Cache leftmost node internally Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
  [PATCH 2/8] sched/fair: Replace cfs_rq->rb_leftmost Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
  [PATCH 1/8] rbtree: Cache leftmost node internally Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
    Re: [PATCH 1/8] rbtree: Cache leftmost node internally Jan Kara <jack@suse.cz> - 2017-06-09 09:50 +0200
      Re: [PATCH 1/8] rbtree: Cache leftmost node internally Davidlohr Bueso <dave@stgolabs.net> - 2017-06-09 16:40 +0200
        Re: [PATCH 1/8] rbtree: Cache leftmost node internally Jan Kara <jack@suse.cz> - 2017-06-12 11:50 +0200
  [PATCH 8/8] fs/epoll: Use faster rb_first_cached() Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
  [PATCH 5/8] lib/interval_tree: Fast overlap detection Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
  [PATCH 6/8] lib/interval-tree: Correct comment wrt generic flavor Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
  [PATCH 7/8] procfs: Use faster rb_first_cached() Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200
  [PATCH 4/8] locking/rtmutex: Replace top-waiter and pi_waiters leftmost caching Davidlohr Bueso <dave@stgolabs.net> - 2017-06-08 20:10 +0200

csiph-web