From patchwork Sun May 5 14:25:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13654315 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 7D3E7C25B10 for ; Sun, 5 May 2024 14:27:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 184626B0095; Sun, 5 May 2024 10:27:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 135246B0096; Sun, 5 May 2024 10:27:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3E4D6B0098; Sun, 5 May 2024 10:27:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D7D6F6B0095 for ; Sun, 5 May 2024 10:27:12 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 95FEFA1395 for ; Sun, 5 May 2024 14:27:12 +0000 (UTC) X-FDA: 82084569504.28.7817BBA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id 04531C0005 for ; Sun, 5 May 2024 14:27:10 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z9J6N0yZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714919231; 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=xv1c3NSNlbKJt7QC2dkLsLhlMd2xAG4RTcPEyFkesSs=; b=oh0yIOu/j5uNOdqJ0L61J0w11Baczj95YnwhdbJZcxSFuXEutMM5ivy/11OeDq5oq3EoTt 6mm6n4MSklYvJ3/py0bom5C2GDpoZmB5kCxiC16xeF9AmsIzhZtqmu9/geUyvS47d2CzXf GqNUD3Z3JulsEmm/W1UT0pIo84oC27E= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z9J6N0yZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714919231; a=rsa-sha256; cv=none; b=0D+GkQuCtKC2fSoB60lQ0OCykingTimevkMIUb6Mef8g8bPNSj5z8AQWCKLlxCIwGuYeoC 2P6KMcJUBGwzsuGYsQ6DsvdDzLo9sry28fXQVMDmcaPhl8jsUi9IH4lNrnKaUlpGW6GjoN wGy5oLYZqhLjhkwOauynKpuchJiRMEE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2D59160C85; Sun, 5 May 2024 14:27:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AFF0C4AF18; Sun, 5 May 2024 14:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714919229; bh=S2WO9rrdnIu5PceUjVXVwYLrUCttkXy1oVefr4+OvH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9J6N0yZo/WUWpqhiJ/VyRoz69PO3DWhKmxX4w/INOl9LHYWHgQFa9/OwlRwWcTnT 9U0e2wSypq0tIwNxA98Zo0poMoKrSMYSxWK8XwyvukXM8PePB1nHZoNsiCakJePlAp e4+4+nyN4nTWsi6slAh+/wYcojeSzZsESNPdzXG4AKCWhIBdxvZfv+BQsMNWBtlJi1 bmj/+kEB8uLuitBKHKy0PNR/PODXSzhhHz3l62d9vL9nUt/6xnKh8KQ6/qDpsblRUc ZzSKpK8jNbiMYadUMJGe6vv80DbiKnzlWwOwB2ATSsuVJVRI4xUHgEKguamYUfA+/U NBfZ3QPtHC0Mw== 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 , Liviu Dudau , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , 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 v8 04/17] sparc: simplify module_alloc() Date: Sun, 5 May 2024 17:25:47 +0300 Message-ID: <20240505142600.2322517-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505142600.2322517-1-rppt@kernel.org> References: <20240505142600.2322517-1-rppt@kernel.org> MIME-Version: 1.0 X-Stat-Signature: irh1xjj93u83gyzdq918qgs9sj8y9dxc X-Rspamd-Queue-Id: 04531C0005 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714919230-285410 X-HE-Meta: U2FsdGVkX1+udYtP/+daPyNoLCwbEn1YH3gcnfQfglqeS5BEGfMd7mjCKJd4TzgQfjkU/IvY6nfLn1vXc+Mc9f0dWO47GJLFit4C6kL2LtYMNJewee7ir46sEAjRz8ArQxmCGXp9ZrN2huMGXTLA27V0mZfCVOL+L/SM8LV2kGFJTf4RQygGmF3KPTQIW6JbtdtF58Pd6uNCvrvIWjaAqBjizgPbIJZpRoA9O+GPnQRkbSkm2yk6WO46Wy+ZpYpZW27KHdZYBW/bX5/4n5mxqgNqwrCnh5TW5LiLToNgqRd9jGvmM2nl2E+mfM9erTQlLpsITqlJoPc2e/kHLoLUntXitpFJcFnpJVn0s9oUTOvo3T0DQIEkvgDTpPILnrFTSQ3TcidKFrXUmsMS/fQ7wGuIxa9KWxHkqfl9xSWrzODm8gmkuZSkfWtD65VmHXExxpNw8S0OJzM2BW4/nKaqtg7fMiWxjJVPaKrn4JF8XYfXs/gHFAjOZIVz+W/fdB6pdmxhk7IH7q1ugxynnI+0RdV4MclKgQRWWaEbhz+vc+VGWgYvAxpBqWKQOCQI6Pd7dbpaPdZZ1U0FdwW5BjrW1zNqtdt5yYYJ6Gv7yp6y37XugCQVb89R/fx3aTsU4UQKZfPIsKMt+sNLGEFrsqk7M2oMGzzMK0mkZ1rFpYzNSCJm1uJTcqk16vZiSm1u/4kZNoTeT3V0o1rC2QQtfUo9oAEVeyhe2nYyAEFmTmgBecNTH1VCf/GtpuoSTfInP0i06u1T4L0+BRRr1moSSY8dT1eNKYLWT7TsFL1JkaBCK/d+3fAAW2zRX3LfT7oPvBBfXcAV1rN1ah1Y7bdmoCExaaka92mu5R7llasVy9SLaw5pjV4iKdfDVql/RqRfOKbT4u4RIuRgcFUEgoNrst0GOcFgR3A/EHI4PN6+MxtY/ehsXXgq5e6hIaJaEhyiQWHKTXeacgajzpidTVUwRHX WvCn/QMb 462SzuIi43+eFk9C5L04fdtqIiu20d4ENrdL5sIVe1y8nWbLPcJ0YqEMmqreim8ApD1D0DM9tBQW3T2KQKqTvTHkd+1+8zbJ/bjqSZ16olKrLVbIlkNegaRLR3Xkvyc9Y1EJ1Nod36rTP63WjfABD+7U2Yu8yk89vIC4sQEz5pwJ4CwvUQWsRhTNl9B1IVNMVGGvhjKABNfa5ufe365BO//u1iRyeSyiav7n+MtMr9eu1169zTZ+0eDhZQp6tiTc4Ihj+K6zjoODrKEib5XUXj3o3fHcsNGEycqOaC10H1e7m6VY4aD41zjuCom3LIV9YPMgn1JeyKWJQoU1o5J6PgWuR/xiPenn2ydmInW8mEQ1a1tgW57qxeZhxIsEuf91eIgA9Qq7ZFj57rW9kkzhQOcWiMS3dF2rZfkxA3IUJWXJi1Bh6Cm243s/d+TT/PoD+ihtBWc1gz6UQ1ulnIDRgLkku1j8eXwBiwsFxKQqZXAisHiC8smI+UUpwSqRuTsOMCdfnIRrjxkPhbnjY3bH3AdPOf+CDyQTLbSqHO6Lq0cRa8vqqpQEEA1PjP0k6siRSmo+3+X0A+vpKf3ZJV1j8jZAF7LujVWBfH2/O6s54xo1wACg= 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 becomes identical for both 32 and 64 bits. While on it, drop unused include of Suggested-by: Sam Ravnborg Signed-off-by: Mike Rapoport (IBM) Reviewed-by: Sam Ravnborg --- 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,