Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3536902rwd; Mon, 22 May 2023 15:47:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6C6/sSjQXRrQcdbJUX68UQybk8nL0NLmhIw6aCLGuD/f7hjaRRIJpFBCJcieWvjdCkwctK X-Received: by 2002:a17:903:48e:b0:1ae:4248:c7f with SMTP id jj14-20020a170903048e00b001ae42480c7fmr11373865plb.48.1684795648499; Mon, 22 May 2023 15:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684795648; cv=none; d=google.com; s=arc-20160816; b=t/W2Qz7AMXru8tGYSp0OT/7HboVvMa5GPfXO0SZLpdZaOWxkZDTB8fytQC+VDP09O1 BX2eK1EHpPjw9I1Ka3icus6Bvsfrt4TyCqKWY9TSNMpdcQqiBB6QgAlP4C2o1mL9Yod6 c8P9cZLeqfNIBkwIKxB/tFNayw1du26ormyyqhET8ADBT02gqOckwnA4QsTm0gobPdZt t+1t4YrkdSLeJDHoPXiyrKBMx+96vrnrh19Su3MvQtd7HRnB1PmaoYXMeyO/BEHjWfYy hz+LJMaIZh13w6SH1Hx8sbHIMn8eheq0pdCV9l06o8eYHEG4isGqxn8r8rC5d6trldCp nmxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=wpJPjBbO36YZsQB1wleZ2Bxu2UdyRVdF2s/GAkF1LgA=; b=wIjUYZYvnzQaP3W/RiJw93T+DW2ui8foDwdKLvDe7GTPtp4xOXrcObQjhh660/0w9M Pe/NESR9Q70eAgGTsVtT7PHBbxYODVvfm9cSz+fgNqseqKx4N1XjVk/DQG03PfvhCzrj XJdRdHAz3msCD/LVjLHW1Beo+YLPxLdy046HFwaTFkUWNYyd7XrHbfH/tztwtywzUNVe lcA1mfmNe1cEOao8QXxCP6dfvNjRsqs50H/3tKW4s96TQesKcvYz/mJ9VK4ZhBprXLmE yPo4RW4n6G1WmTvzJbJSXJdD+sA1qd597CfZg8GCNniJc0U9OTshVcDsA88LJAjOe01n F34Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="f5uM/5MI"; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a170902e75200b001afb739cf5csi2240324plf.175.2023.05.22.15.47.13; Mon, 22 May 2023 15:47:28 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b="f5uM/5MI"; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234542AbjEVWFS (ORCPT + 99 others); Mon, 22 May 2023 18:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234547AbjEVWFQ (ORCPT ); Mon, 22 May 2023 18:05:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656E4FE for ; Mon, 22 May 2023 15:05:12 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684793109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wpJPjBbO36YZsQB1wleZ2Bxu2UdyRVdF2s/GAkF1LgA=; b=f5uM/5MIW0ZkXJ9BPDjgcMNARkDHM2QetrKjkOB1cVAqL7vbg19E6CkXwdoHwQHtTnmHuf or3nmZ8kdIbB9QKEqw5QhRqrNdvP1ToeDz/z25//8J4uppaLJf0Lh8q8Li9RLRTvOXKhHV 8Punl3e6gqtDEAQQlzbGvGV5iptxcJtzq2wO5AqA0FZiqdov0RL51r1XTAFqPbEwOwJYKN 3cavbhBQJP8AxMSA9umnVFXipxHSFpITBZgPOUXTfOwG4hyz7o+UXXKM5rzt6Q79mYtVOO AfSsGOGmmxcy5uEtOma5DHqP5wmaQMwFQtin5g4wPd18/yyfkBFC6JaM6q15ew== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684793109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wpJPjBbO36YZsQB1wleZ2Bxu2UdyRVdF2s/GAkF1LgA=; b=oqtmX16LwEasfr+qYEpMoInQ/KL5S5cOZa9a7pH56YdtXnXfrgw5DUgsCI/DNjnyTm+6di xkLcVzBgYHGZRaDQ== To: Song Liu , Mike Rapoport Cc: Kent Overstreet , linux-mm@kvack.org, Andrew Morton , Dave Hansen , Peter Zijlstra , Rick Edgecombe , Vlastimil Babka , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [RFC PATCH 1/5] mm: intorduce __GFP_UNMAPPED and unmapped_alloc() In-Reply-To: References: <20230308094106.227365-1-rppt@kernel.org> <20230308094106.227365-2-rppt@kernel.org> <20230518152354.GD4967@kernel.org> <20230519082945.GE4967@kernel.org> Date: Tue, 23 May 2023 00:05:08 +0200 Message-ID: <878rdgvx7v.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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_PASS,T_SCC_BODY_TEXT_LINE 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 Fri, May 19 2023 at 08:42, Song Liu wrote: > On Fri, May 19, 2023 at 1:30=E2=80=AFAM Mike Rapoport w= rote: >> What I was thinking is that we can replace module_alloc() calls in your >> allocator with something based on my unmapped_alloc(). If we make the pa= rt >> that refills the cache also take care of creating the mapping in the >> module address space, that should cover everything. > > Here are what I found as I work more on the code: > > 1. It takes quite some work to create a clean interface and make sure > all the users of module_alloc can use the new allocator on all archs. > (archs with text poke need to work with ROX memory from the > allocator; archs without text poke need to have a clean fall back > mechanism, etc.). Most of this work is independent of the actual > allocator, so we can do this part and plug in whatever allocator we > want (buddy+slab or vmap-based or any other solutions). > > 2. vmap_area based solution will work. And it will be one solution for > both < PAGE_SIZE and > PAGE_SIZE allocations. Given > module_alloc is not in any hot path (AFAIK), I don't see any > practical issues with this solution. It will be a little tricky to pl= ace > and name the code, as it uses vmalloc logic, but it is technically a > module allocator. > > I will prioritize building the interface, and migrating users to it. If we > do this part right, changing the underlying allocator should be > straightforward. Correct, that's the only workable approach. Once you have solved #1 the mechanism of the underlying allocator (#2) is pretty much exchangeable. Any attempt to solve #2 before #1 is doomed by definition. Thanks, tglx