Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753760AbbBZMAp (ORCPT ); Thu, 26 Feb 2015 07:00:45 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:34279 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753184AbbBZMAn (ORCPT ); Thu, 26 Feb 2015 07:00:43 -0500 Date: Thu, 26 Feb 2015 13:00:38 +0100 From: Ingo Molnar To: Peter Zijlstra Cc: Andi Kleen , Andi Kleen , x86@kernel.org, linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com, rusty@rustcorp.com.au Subject: Re: [RFC][PATCH] module: Optimize __module_address() using a latched RB-tree Message-ID: <20150226120038.GA4779@gmail.com> References: <1424482737-958-1-git-send-email-andi@firstfloor.org> <20150223170436.GC5029@twins.programming.kicks-ass.net> <20150223174340.GD27767@tassilo.jf.intel.com> <20150226114309.GR21418@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150226114309.GR21418@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 867 Lines: 30 * Peter Zijlstra wrote: > +static struct module *mod_tree_find(unsigned long addr) > +{ > + struct module *m; > + unsigned int seq; > + > + do { > + seq = raw_read_seqcount(&mod_tree.seq); > + m = __tree_find(&mod_tree.tree[seq & 1], addr); > + } while (read_seqcount_retry(&mod_tree.seq, seq)); > + > + return m; > +} Btw., if your approach works out fine I bet we could add one more optimization as well: a PER_CPU(last_module_found) front cache would help as well, as usually there's quite a bit of repetition between addresses being looked up and the resulting modules. Thanks, Ingo -- 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/