From patchwork Mon Apr 22 08:47:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13637945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A05DFC07E8F for ; Mon, 22 Apr 2024 08:48:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33E9A6B00A2; Mon, 22 Apr 2024 04:48:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2EE736B00A3; Mon, 22 Apr 2024 04:48:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B5D26B00A4; Mon, 22 Apr 2024 04:48:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F3AC56B00A2 for ; Mon, 22 Apr 2024 04:48:14 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A9960A192F for ; Mon, 22 Apr 2024 08:48:14 +0000 (UTC) X-FDA: 82036540908.27.0A076AE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 0521BC0007 for ; Mon, 22 Apr 2024 08:48:12 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=I8V3k3ae; spf=pass (imf22.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713775693; a=rsa-sha256; cv=none; b=w1RC9BmHmtIU5WHmIenoC4R5eVitlzABWzBfOE/7iusff6HkzqQtjYcgB8DZ5Ey1EcSL3/ ZdzW7S6BSBi3akRqowf/vysHZ6hO54oYBCmAeQyYeABgFoEnfnNwYAUENkAjQVnYLq7eGO /hSshG7pzuq1bgZhcrGPTSUY+hhTmXw= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=I8V3k3ae; spf=pass (imf22.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713775693; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gLcqR744GpBLkE5pWgIaCTqVpjjcEZ9vTTfJ8PMlxfg=; b=YmEbGHPxviHFDRQ1of44sHt/wgaqmZmC0L39bFdpB8tpVtXIWtamHA1264+hINBQEk2kPD NppjMrPNGaYzZnZ9Q0keI4Wivo/4RMJpav7c2C1HLtU98afitb532oKOKmugVlgFJNnCvA plqNnO/qirKN5/SpPP/aKs+vpXD49Zg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1656460C2D; Mon, 22 Apr 2024 08:48:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCC93C4AF07; Mon, 22 Apr 2024 08:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713775691; bh=jgYZaFJ37N18LMQ1WJO1fYtb83p+Fzz2HBcTxrLBVpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I8V3k3ae+9naHvOaS6cJwZtIckHUimrtIXelVHd5reDyqWCurUcuLYiFrVR7O5rJe WLIw/fq4qdtK1pzNhArGAYpXocScZzwOAM3eSJkaQMvhdEAdFBJ3Onzum5GB1OKsAQ DLZDAQ9CNeHTM2loHlLef0zHOcCw2eMgd1Rc9O7qAS6dxqepCyJCkhdxnjhREXsEjd nMtbwuxADbrM+ZssO5VQfMWLwyIX8x1WboReEgX2937yBXh8DBE+eW9mvsv7XFo+I3 RAgkM1Nskbw2jhMiHCS50BRyxm4qNoiEw38803qAZtCA2JGgNF0zbR7A2N1nCSWIvE 18qq2Eo73azpQ== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Andrew Morton , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , Rick Edgecombe , Russell King , Sam Ravnborg , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arch@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: [PATCH v5 04/15] sparc: simplify module_alloc() Date: Mon, 22 Apr 2024 11:47:12 +0300 Message-ID: <20240422084717.3602332-4-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422084717.3602332-1-rppt@kernel.org> References: <20240422084717.3602332-1-rppt@kernel.org> MIME-Version: 1.0 X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1uuhYwrCe+wtoRpDJ5CKKQRpj+t ba0xK0hc TeV4hYVk5ln/AI4hKZhedMBk8EAdxjV3tlWlQCo+LB1t5BAU/kBIx/iXzbJ91PQo00K5fs+7bLTMkRmeEHIHgQ9+YCS/WICuoKQu/f2C4aqy4Pq6gzMKqumHXM6A4gNDOPiKGeSeZ/2EIqVJTojSF7uDB7XDKR8xv8FpBvbeeBdwKjxXZuP6/11XGVoZ5wODN7hnn+fgIT5vDmHxtzbYOAuA4UburPLKn90N3oHsv7eHtuodT8Dpavr4cGFp/e8M3l1HDOq7PWyNAEogwUvRaOhmnspRv5b3ck2qCxzWVEKceQPaA4iKIU15XVA8DCb2+lCSzSeHpwHNqGgqV1urqJy8jw0ICv61W63xzLKbDF26yzSSONvB9vgqKomRmNahhUobJvS87wQBNtEE3HuYyCO0oI3abiyVVxWCN4AqXgqtS8fXVsRUgWyBEWHrskXU9gfP9eJc+GsncE5cq9FHOAYGPcdHlaVN8XsHT4GTgg3K98MvFdEBWBoKR+t8OekGFreEg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: "Mike Rapoport (IBM)" Define MODULES_VADDR and MODULES_END as VMALLOC_START and VMALLOC_END for 32-bit and reduce module_alloc() to __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, ...) as with the new defines the allocations becames identical for both 32 and 64 bits. While on it, drop unsed include of Suggested-by: Sam Ravnborg Signed-off-by: Mike Rapoport (IBM) --- arch/sparc/include/asm/pgtable_32.h | 2 ++ arch/sparc/kernel/module.c | 25 +------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 9e85d57ac3f2..62bcafe38b1f 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, #define VMALLOC_START _AC(0xfe600000,UL) #define VMALLOC_END _AC(0xffc00000,UL) +#define MODULES_VADDR VMALLOC_START +#define MODULES_END VMALLOC_END /* We provide our own get_unmapped_area to cope with VA holes for userland */ #define HAVE_ARCH_UNMAPPED_AREA diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 66c45a2764bc..d37adb2a0b54 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -21,35 +21,12 @@ #include "entry.h" -#ifdef CONFIG_SPARC64 - -#include - -static void *module_map(unsigned long size) +void *module_alloc(unsigned long size) { - if (PAGE_ALIGN(size) > MODULES_LEN) - return NULL; return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, __builtin_return_address(0)); } -#else -static void *module_map(unsigned long size) -{ - return vmalloc(size); -} -#endif /* CONFIG_SPARC64 */ - -void *module_alloc(unsigned long size) -{ - void *ret; - - ret = module_map(size); - if (ret) - memset(ret, 0, size); - - return ret; -} /* Make generic code ignore STT_REGISTER dummy undefined symbols. */ int module_frob_arch_sections(Elf_Ehdr *hdr,