Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1174173rwd; Thu, 1 Jun 2023 11:27:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mk1bVtHk+RnW6Jkl2syiUwNdmbTocsRH7sVOlef2/bsyGNQ/xU+Gx+/was6nSTzUlYDDj X-Received: by 2002:a17:903:22c7:b0:1ac:7405:d3ba with SMTP id y7-20020a17090322c700b001ac7405d3bamr210292plg.40.1685644063222; Thu, 01 Jun 2023 11:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685644063; cv=none; d=google.com; s=arc-20160816; b=kFIRB3TyYkRgmWByZ1NInrb95lpU0hBXZEio+VzThG09uQgm8ZDpQaRVgouNqhQhWA UJBvN4ldMaZlP26tulCOm0hcNA1GrnZhexrKZVuL2npDcrVETxlqCMXd3q9+Lx3/7FAj oU61+vcO72yEYoQCTApjUNskIWUEqEY/Z+mKQum9zNjdkJzGa4xTND8ojJE7zyrVaXy1 UXIH2qCHNwKoihi4emePZVrObue9eVQbPrsamMThkFFUoxxZuZetXFiCvPt3TZp97LuN roB018Z5cqYB4gZaJajLmjfpyxQavepU1i4sso5j4kUmWXmLK/Hqi4p4o7yd3aT2p4CL KxGw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=ZJB8Y+qWnzDFm68SRo4Caqik2FMGAG+Lwf+CLh2n8l8=; b=FVMAipKoiKp4WQW+EB/EqxMjda7gPzLjF8C7ZmXVhz+k5M52Qarofxa/NviGTF9ofP +ZnC/Pqfzy9F1Gyr3W/3T52YL6KyVApYJTuU0ruhcGq4nDcbIkJKiPEavx8YdmW2IBz6 S2k6AHQ6dEQfM1x80Po+HPbT9xlQLugNHEa4o3l8iKrtr89r3K6vGWDvjEguOhRkCHNM uumDdmz2Xr/06fYMRR44wpi/cCcZG03dy61IontcNQ43BZ4HRNTaGIhSpvzghxKPObwc UermIknD2FpnaC6fxXCpFCdTULFZt2YIwnSb5eh1dz/PkCeJYo3H1T656gqvtjWbFPFw AdCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=heVebVBy; 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=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a170902e74500b001b0473abd39si2769955plf.483.2023.06.01.11.27.31; Thu, 01 Jun 2023 11:27:43 -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=@linux.dev header.s=key1 header.b=heVebVBy; 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=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231615AbjFASPO (ORCPT + 99 others); Thu, 1 Jun 2023 14:15:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbjFASPH (ORCPT ); Thu, 1 Jun 2023 14:15:07 -0400 Received: from out-54.mta1.migadu.com (out-54.mta1.migadu.com [IPv6:2001:41d0:203:375::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD14919A for ; Thu, 1 Jun 2023 11:15:04 -0700 (PDT) Date: Thu, 1 Jun 2023 14:14:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1685643302; 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: in-reply-to:in-reply-to:references:references; bh=ZJB8Y+qWnzDFm68SRo4Caqik2FMGAG+Lwf+CLh2n8l8=; b=heVebVByNmhUMsJ2WAULJ9HLAPC6refckfCUJY0WXx4hRhZsbaomDSDugjYWaWQ6LEkWdP Jvcs9tQIzXZc+0yCsv5NbHMBQcwZQ1wXx/fNbx6WxFVHuREaPuDV58w3hONj9KdJXnaniY jN/vCOKQCwHm3op0QMHWhM09SJgJWkM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Mark Rutland Cc: Mike Rapoport , linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Luis Chamberlain , Michael Ellerman , "Naveen N. Rao" , Palmer Dabbelt , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 00/13] mm: jit/text allocator Message-ID: References: <20230601101257.530867-1-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Thu, Jun 01, 2023 at 05:12:03PM +0100, Mark Rutland wrote: > For a while I have wanted to give kprobes its own allocator so that it can work > even with CONFIG_MODULES=n, and so that it doesn't have to waste VA space in > the modules area. > > Given that, I think these should have their own allocator functions that can be > provided independently, even if those happen to use common infrastructure. How much memory can kprobes conceivably use? I think we also want to try to push back on combinatorial new allocators, if we can. > > Several architectures override module_alloc() because of various > > constraints where the executable memory can be located and this causes > > additional obstacles for improvements of code allocation. > > > > This set splits code allocation from modules by introducing > > jit_text_alloc(), jit_data_alloc() and jit_free() APIs, replaces call > > sites of module_alloc() and module_memfree() with the new APIs and > > implements core text and related allocation in a central place. > > > > Instead of architecture specific overrides for module_alloc(), the > > architectures that require non-default behaviour for text allocation must > > fill jit_alloc_params structure and implement jit_alloc_arch_params() that > > returns a pointer to that structure. If an architecture does not implement > > jit_alloc_arch_params(), the defaults compatible with the current > > modules::module_alloc() are used. > > As above, I suspect that each of the callsites should probably be using common > infrastructure, but I don't think that a single jit_alloc_arch_params() makes > sense, since the parameters for each case may need to be distinct. I don't see how that follows. The whole point of function parameters is that they may be different :) Can you give more detail on what parameters you need? If the only extra parameter is just "does this allocation need to live close to kernel text", that's not that big of a deal.