Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6656572rwb; Wed, 18 Jan 2023 07:52:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXvqUOvJ8aM6I64ioRB1wjSXC/EAdcL4qURbqSgrCEHh9JFLxkVYK6Cp28Ybk5FeuIV8lina X-Received: by 2002:a17:906:c50:b0:862:fc76:6f8e with SMTP id t16-20020a1709060c5000b00862fc766f8emr7174771ejf.36.1674057132490; Wed, 18 Jan 2023 07:52:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674057132; cv=none; d=google.com; s=arc-20160816; b=I/yqv6+jCRP/jvs0eVyOgtGDkkxeuJRfyEX6oRwO6P4W/hLfvgnZOceHpLh+6EkyCL 2Xnc55Z5IC4dCofPUd0rnowOk2P6D6A/crZSeQ2SnKEvTXp1ZXrmk823d+iWcG/exQFe Jv7TwaM6PTc3TXLAEB7BEUp72vt5dMiOLIdcn0Gc9HM/Z5mGFAyDEV+YOl1Hvibxyfc8 d0z5Z7LfToX+Deyq/8Ucjw+Xo+W0nDH+5D9XzviC9yrJxFS8SGTGb+azqvV3JZpW40et UyWMjo3TpbOA8ZNEszuM8hStXTOrgvL2Mriy9rkvic9A0urwN8Vs4IVBYAPWGAj7KTqF vGjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xhFVQwoO2lkjv9nSA2b817JkR90qQlSjNN6ZfOzjzd0=; b=QRuVJMi0iP+dmF2BgKtTrP73dLg8kKJQNPk4JqW1hFPA/6Uai/TvnVK0P2QxbtaPf4 yYmTkz9G1v1GEyENcHhz2X1GNGvRmN+ufHLoOMOnql7KzYetqjg0t6uwF0aU8x1dMOsr EiGYwAPYwcARkOmur3XCsDwYBBCDR3ztbFGU+7f8losqxQib8SHF2NgFljXbtm69qSlF tPI4jf0T6M8UetIpKWbbIdE8+Z4RqKgZxUg+xmAzacb4PgejTXuOBWD8rYDtWJqzuw04 cK5DtvoRTSS4XUuazSnwAZdNf7HkiMuGAWWcmsMF8316fOYPq23g0VGq1rG4uQWpfZ/N fygw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pOKfESI7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp23-20020a1709071b1700b007826cb6f57csi37889530ejc.407.2023.01.18.07.52.01; Wed, 18 Jan 2023 07:52:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pOKfESI7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbjARPHn (ORCPT + 45 others); Wed, 18 Jan 2023 10:07:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231281AbjARPHi (ORCPT ); Wed, 18 Jan 2023 10:07:38 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3591A4AA; Wed, 18 Jan 2023 07:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=xhFVQwoO2lkjv9nSA2b817JkR90qQlSjNN6ZfOzjzd0=; b=pOKfESI7xIN2zuFLgcHfU7E+J6 I6dzZsWXkpu4laeHuUhFIlCVEf3uhb/e5JxiHDAWTcqdJVCVagDuzi3TrAHCouwRUFKcwQ94WEI0M DJqtglvitIE0PO94WhXZsK0MuT5bRIFZUTeCSa4OwX+yXpMbMakT+HZIlW7cvk7CKD2zqSQAKl7Zk 8PfNyN5qzZlyjP2w9CpfHh+LAScS/unEneETNJfcRE3Np3ys0WOtdZYFnJINgz4MTHFM+lbc/fvLe 6Qik9F00/hV2RqZiajh/F32dkI8f/3hJ7I4pyF1utZk3wD2BZERs+WBNVQCvRBRupx0SKoY6JLSgg lSiEn69w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIA26-0005bw-Tj; Wed, 18 Jan 2023 15:07:23 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DC77430012F; Wed, 18 Jan 2023 16:07:17 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 97A9420A60F37; Wed, 18 Jan 2023 16:07:17 +0100 (CET) Date: Wed, 18 Jan 2023 16:07:17 +0100 From: Peter Zijlstra To: Christophe Leroy Cc: Song Liu , "linux-modules@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "songliubraving@fb.com" , Luis Chamberlain , Thomas Gleixner Subject: Re: [PATCH/RFC] module: replace module_layout with module_memory Message-ID: References: <20230106220959.3398792-1-song@kernel.org> <83941b74-7585-235b-ee54-3b127ca70d9e@csgroup.eu> <154ed99c-5877-35f6-5e7d-9d7abada7d33@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <154ed99c-5877-35f6-5e7d-9d7abada7d33@csgroup.eu> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 10, 2023 at 06:31:41AM +0000, Christophe Leroy wrote: > Le 09/01/2023 ? 21:51, Song Liu a ?crit?: > > Do you mean one tree will cause addr_[min|max] to be inaccurate? > > > > Yes at least. On powerpc you will have module text below kernel, > somewhere between 0xb0000000 and 0xcfffffff, and you will have module > data in vmalloc area, somewhere between 0xf0000000 and 0xffffffff. > > If you have only one tree, any address between 0xc0000000 and 0xefffffff > will trigger a tree search. The current min/max thing is tied to the tree because of easy update on remove, but module-insert/remove is not a performance critical path. So I think it should be possible to have {min,max}[TYPES] pairs. Either brute force the removal -- using a linear scan of the mod->list to find the new bounds on removal. Or overengineer the whole thing and use an augmented tree to keep that many heaps in sync during the update -- but this seems total overkill. The only consideration is testing that many ranges in __module_address(), this is already 2 cachelines worth of range-checks -- which seems a little excessive. (also, I note that module_addr_{min,max} are unused these days)