Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933129AbbDIQbU (ORCPT ); Thu, 9 Apr 2015 12:31:20 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:35908 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932548AbbDIQbR (ORCPT ); Thu, 9 Apr 2015 12:31:17 -0400 MIME-Version: 1.0 In-Reply-To: <20150409121336.GU5029@twins.programming.kicks-ass.net> References: <20150408164813.810874878@infradead.org> <20150408170044.130755544@infradead.org> <552633A3.5020502@cn.fujitsu.com> <20150409081420.GM5029@twins.programming.kicks-ass.net> <55263E69.3020305@cn.fujitsu.com> <20150409121336.GU5029@twins.programming.kicks-ass.net> Date: Thu, 9 Apr 2015 09:31:16 -0700 X-Google-Sender-Auth: iiy1I9Cz9MFlkfU37k4C3aMlB-w Message-ID: Subject: Re: [PATCH v4 6/9] rbtree: Implement generic latch_tree From: Linus Torvalds To: Peter Zijlstra Cc: Lai Jiangshan , Ingo Molnar , Rusty Russell , Mathieu Desnoyers , Oleg Nesterov , Paul McKenney , Linux Kernel Mailing List , Andi Kleen , Steven Rostedt , Thomas Gleixner , Michel Lespinasse , Andrea Arcangeli , David Woodhouse , Rik van Riel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 866 Lines: 25 On Thu, Apr 9, 2015 at 5:13 AM, Peter Zijlstra wrote: > > struct latch_tree_node { > + struct rb_node node[2]; > }; > > +static __always_inline struct latch_tree_node * > +__lt_from_rb(struct rb_node *node, int idx) > +{ > + return container_of(node, struct latch_tree_node, node[idx]); > +} Ugh. That syntax of offset_of() worries me a bit, but some grepping shows that we already use this form of offset_of() in parts of the kernel, so I guess it's fine. Even with that small "Ugh", I do have to admit to preferring this to having the back-pointer. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/