lkml.org 
[lkml]   [2015]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 6/9] rbtree: Implement generic latch_tree
On Thu, Apr 09, 2015 at 04:09:07PM +0800, Lai Jiangshan wrote:
> On 04/09/2015 12:48 AM, Peter Zijlstra wrote:
>
> > +
> > +struct latch_tree_node {
> > + /*
> > + * Because we have an array of two entries in struct latch_tree_nodes
> > + * it's not possible to use container_of() to get back to the
> > + * encapsulating structure; therefore we have to put in a back pointer.
> > + */
> > + void *priv;
> > + struct rb_node node;
> > +};
>
> I don't think @priv is strictly needed. It is possible to use container_of()
> to go back. @priv is even not used in this file (except the initialization).
>
> First, we can use container_of() to find encapsulating structure from the
> struct latch_tree_nodeS.
>
> Second, we can add a @idx to __lt_insert() and __lt_find(),

insert yes, find no. Remember that both nodes are in the _same_ tree.

There is no way of knowing if a tree node is an init or core node while
iterating.


\
 
 \ /
  Last update: 2015-04-09 10:41    [W:0.128 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site