[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55263E69.3020305@cn.fujitsu.com>
Date: Thu, 9 Apr 2015 16:55:05 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: <mingo@...nel.org>, <rusty@...tcorp.com.au>,
<mathieu.desnoyers@...icios.com>, <oleg@...hat.com>,
<paulmck@...ux.vnet.ibm.com>, <torvalds@...ux-foundation.org>,
<linux-kernel@...r.kernel.org>, <andi@...stfloor.org>,
<rostedt@...dmis.org>, <tglx@...utronix.de>,
Michel Lespinasse <walken@...gle.com>,
Andrea Arcangeli <aarcange@...hat.com>,
David Woodhouse <David.Woodhouse@...el.com>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH v4 6/9] rbtree: Implement generic latch_tree
On 04/09/2015 04:14 PM, Peter Zijlstra wrote:
> 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.
> .
>
This sentence is talking about module.c not latch_tree.h. So I guess
it is user(module.c)'s problem, not latch_tree.h's problem.
The user(module.c) can wrap the struct latch_tree_nodes and add @priv.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists