From patchwork Mon Oct 7 06:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13824104 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 9111ECFB442 for ; Mon, 7 Oct 2024 06:29:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 273DE6B0102; Mon, 7 Oct 2024 02:29:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FA7F6B0103; Mon, 7 Oct 2024 02:29:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 074F76B0104; Mon, 7 Oct 2024 02:29:42 -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 D42736B0102 for ; Mon, 7 Oct 2024 02:29:41 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 91AF512108F for ; Mon, 7 Oct 2024 06:29:41 +0000 (UTC) X-FDA: 82645830162.12.6420A37 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id EC90240017 for ; Mon, 7 Oct 2024 06:29:39 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=i6kzY4uJ; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf11.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=1728282481; a=rsa-sha256; cv=none; b=GUZkKUshuThMfG8SkOT1Uzm+WQDlEmtZ2WiqpTuUNLF95MHHxWOjsr8Sf6ucmanOxWlAeW vjfl0D258cOdODARxjAZPucOOg/aSu0oJwEjJnZs0M27fGfUYNEun740lyKMTacAgAgFHu 9F0HcVwbKohFvvY6XOdrjhPNs9WeApE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=i6kzY4uJ; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf11.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=1728282481; 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=9RBK7hzpFiwpS3WuLNGRSra8wn5hmFuuSqvvSgDdvkw=; b=zhgG8wMViAWuHWvPtvn2iI5dZ2qaAxCTOY6gm2vrSdm1N/qDvTlXfbFOYUCfRMmuN+YmYy u0T6N0HUJ08mO9TXqc7DHr1DvXJCpReztXoRUL3YL/q3LOLszsM/JT7FeKwDAS1y6+mJhm S2yqtqFRrCcVTwgc+tS+BgoTqKTwp3I= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 806655C54FC; Mon, 7 Oct 2024 06:29:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D4C6C4CEC7; Mon, 7 Oct 2024 06:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728282578; bh=YllkjQvsWrr6dQbJlUjRUABqghggyZA8loEEeE76mk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i6kzY4uJzQ7Qdyz1ZhcA8oSDPkmiOiPfu2ql1HNAVuX7bF+4mNsVR3AmLOTFDBCug 4yJ/CORrw9a+tR+vOAyHFEYuq/4QPBsaYeld57i5u5jtVr7t1ZhKFhpJZ1tt4r6ZIr jTSYc2t3fw6cCpkaBwOA0+cqUyDuQvgetWtjmgomTMNyKeFwGMnmwj0IM4dvsJGDcC E5dkIVjHNUIpFC8/xH3hHgiTzYgAgsjH76us1FHtZgdk6jkNtes9fExTMN+UrWoFx7 L085EY3TXlqxr3FMznPdR+WCKnPPndhV5ia1vNRM8QcOyUe/BeiXjZt/w6iT2kPuL4 i9TugR2R+4SnA== From: Mike Rapoport To: Andrew Morton Cc: Andreas Larsson , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Brian Cain , Catalin Marinas , Christoph Hellwig , Christophe Leroy , Dave Hansen , Dinh Nguyen , Geert Uytterhoeven , Guo Ren , Helge Deller , Huacai Chen , Ingo Molnar , Johannes Berg , John Paul Adrian Glaubitz , Kent Overstreet , "Liam R. Howlett" , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Mike Rapoport , Oleg Nesterov , Palmer Dabbelt , Peter Zijlstra , Richard Weinberger , Russell King , Song Liu , Stafford Horne , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Uladzislau Rezki , Vineet Gupta , Will Deacon , bpf@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-trace-kernel@vger.kernel.org, linux-um@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH v4 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together Date: Mon, 7 Oct 2024 09:28:51 +0300 Message-ID: <20241007062858.44248-2-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007062858.44248-1-rppt@kernel.org> References: <20241007062858.44248-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: EC90240017 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: e9cb46nanbqieeok7we6hseiwaz5q4t9 X-HE-Tag: 1728282579-765089 X-HE-Meta: U2FsdGVkX18d+P0s3V+BJhufImPGJ1Oaw097GcoIxlarGFTAoSmOsbGLJZHC2UgiixMQ+LOI0CTn/lJtI8I10oWrmXwYCNzPEM5hR2ucc8yWhKHElm03WCYA5HwlWc9bQccJGAUvOADTm/BowFH6jP4XtLdqllwMa/0f7rI/xp3NzD28exzR0bs7ADMFi6TggyGXgsNXEfcO6WITtGao7zM4znrf5c3nUhsDB6aL5ihDOOEOhZISkev19bKXDz1Z+jL/rNlFqLGWDzbjKc1wChm6EM7ashztACcvpgkAG84jUvNRuV+ktFFCpaCGEmfSHEZgdmXHKtpnCLkISJ9cL73F91oNvumfgti93hOg3vrjakUzPFjLshJ0swA/2ofCrzDgUDQUNwS1LRyC9zVMHrdz7+ngRbJuQ8BG/u2amdk5L9mT391dV84t3iHTbedaIE5MxkkO/j6XufPSpUOlMUL9lGX8IKCOQGP2ovoW9TlPBGU2ns7Ha2kSnHh5K6hG9fgtvdZIxObj6lpS7d/VUQUqynXfZxK0bNXkv8kGstnagP9TNgre3K1o6qxQnchd/jRZwbayiLUNcsZ+T3svjIQv9pK1Fi8Bw5FKlDnOOYAGYZewcLRfxI//nkdZNJfu3LM4gr5Mtnwfl4guBeQd3QS4yLrrvnIXQE8/TCmHWUPfTCpH4U2MNY8+4uK8xu5IRK+T5oQajF98IiT4n+XPnS8LxDuEweflCe1/Gyk2HJmsXQfkQ28u2SqNJIuBjMhf8Y4Ah+2GWt8VejtqZM0nBtPJyet0Tf5/TjbTRJWcr644qc46kzV8ekG4F6rDLxloyyMaLlOC4/36x/98tZ0WOOKmDs+ow/4kJWE2LaBBKj1l+FjnhCfkFZfnZwZvf7UFtiHz4lkTbGMs+8cIeVYv7yLLmU4eY2435KcuMR6kQbt/ZMCB3xJ2T0lDJgYaMFqi5y5lpUVS2KQiHv8h+/d dUSznjoR znNJqI0UmBmJHhvNDd2rJGu7gXHPVTLRc6Pwd1QZdv5Lzb/czaeUm/l3MEzmsPXf2k609SaTWTuMfjJBye3c0I+EP35z5A4iq4VoxdFdUQKgja2QbppScIOL6yC2xvBqLfRybQM3dfTxrrF0DXbbXruV16UdRRgKLr26dUUgjhdYLrIBDNt9xjkR+JDllGTeOVg96REXXPRzQeoICZHR+GYiNU1shl+MgXsDejYD0Y9TQGPr7HNoMqDxyiiSRNHi7mB5kKCpxwDFCpJ1a0kRV+a7iAlVGHD4HWV+5 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 (Microsoft)" There are a couple of declarations that depend on CONFIG_MMU in include/linux/vmalloc.h spread all over the file. Group them all together to improve code readability. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/vmalloc.h | 60 +++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index ad2ce7a6ab7a..9a012cd4fad2 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -134,12 +134,6 @@ extern void vm_unmap_ram(const void *mem, unsigned int count); extern void *vm_map_ram(struct page **pages, unsigned int count, int node); extern void vm_unmap_aliases(void); -#ifdef CONFIG_MMU -extern unsigned long vmalloc_nr_pages(void); -#else -static inline unsigned long vmalloc_nr_pages(void) { return 0; } -#endif - extern void *vmalloc_noprof(unsigned long size) __alloc_size(1); #define vmalloc(...) alloc_hooks(vmalloc_noprof(__VA_ARGS__)) @@ -266,12 +260,29 @@ static inline bool is_vm_area_hugepages(const void *addr) #endif } +/* for /proc/kcore */ +extern long vread_iter(struct iov_iter *iter, const char *addr, size_t count); + +/* + * Internals. Don't use.. + */ +extern __init void vm_area_add_early(struct vm_struct *vm); +extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); + +int register_vmap_purge_notifier(struct notifier_block *nb); +int unregister_vmap_purge_notifier(struct notifier_block *nb); + #ifdef CONFIG_MMU +#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) + +extern unsigned long vmalloc_nr_pages(void); + int vm_area_map_pages(struct vm_struct *area, unsigned long start, unsigned long end, struct page **pages); void vm_area_unmap_pages(struct vm_struct *area, unsigned long start, unsigned long end); void vunmap_range(unsigned long addr, unsigned long end); + static inline void set_vm_flush_reset_perms(void *addr) { struct vm_struct *vm = find_vm_area(addr); @@ -279,24 +290,14 @@ static inline void set_vm_flush_reset_perms(void *addr) if (vm) vm->flags |= VM_FLUSH_RESET_PERMS; } +#else /* !CONFIG_MMU */ +#define VMALLOC_TOTAL 0UL -#else -static inline void set_vm_flush_reset_perms(void *addr) -{ -} -#endif - -/* for /proc/kcore */ -extern long vread_iter(struct iov_iter *iter, const char *addr, size_t count); - -/* - * Internals. Don't use.. - */ -extern __init void vm_area_add_early(struct vm_struct *vm); -extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); +static inline unsigned long vmalloc_nr_pages(void) { return 0; } +static inline void set_vm_flush_reset_perms(void *addr) {} +#endif /* CONFIG_MMU */ -#ifdef CONFIG_SMP -# ifdef CONFIG_MMU +#if defined(CONFIG_MMU) && defined(CONFIG_SMP) struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, const size_t *sizes, int nr_vms, size_t align); @@ -311,22 +312,9 @@ pcpu_get_vm_areas(const unsigned long *offsets, return NULL; } -static inline void -pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) -{ -} -# endif -#endif - -#ifdef CONFIG_MMU -#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) -#else -#define VMALLOC_TOTAL 0UL +static inline void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) {} #endif -int register_vmap_purge_notifier(struct notifier_block *nb); -int unregister_vmap_purge_notifier(struct notifier_block *nb); - #if defined(CONFIG_MMU) && defined(CONFIG_PRINTK) bool vmalloc_dump_obj(void *object); #else