From patchwork Wed Oct 23 16:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13847498 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 D71CACFA44F for ; Wed, 23 Oct 2024 16:27:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 546226B009D; Wed, 23 Oct 2024 12:27:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D0286B009E; Wed, 23 Oct 2024 12:27:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 322186B009F; Wed, 23 Oct 2024 12:27:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 133F66B009D for ; Wed, 23 Oct 2024 12:27:56 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 592361A0CEF for ; Wed, 23 Oct 2024 16:27:24 +0000 (UTC) X-FDA: 82705397712.03.DB68FBD Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf02.hostedemail.com (Postfix) with ESMTP id 06DDB8000D for ; Wed, 23 Oct 2024 16:27:20 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SDBDDy3C; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729700762; a=rsa-sha256; cv=none; b=g7AZvTiBrx28KsYC3giZinptMb8Zzbz0XCUjatPONQ/zH01dZSRv5bXnyVTbiUVsKRRv6y XhBjmb+u/azPSXZCidVTkTTHL4gzqN4MKvwwB49/HAlGDTMq4ZrIBJo54cbj1JYFB9n802 UTY+wgzfJZ/humWcXOctsyy8DGs+UXY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SDBDDy3C; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 147.75.193.91 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=1729700762; 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=wKL2goMXpCxNBRFMskpdpE4oA7sLYoCtQjT3Y03a47A=; b=yMhlQBNE/NkAwcpkg7wDW81O7FIYvBRSDWQ8TcNr6tUEteUGqw2cLgLLE/5uXEZT8QH8zu UyixGwf+YcLBjF15terpZK3FgyabFCggrZRBzmf8bVcfrJo9nqmiWBqAPkoD/JzSV93nk7 HlAZf/D0dLwMROMiMAhsQr9toWVrGgM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 02F10A43420; Wed, 23 Oct 2024 16:27:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA05EC4CEE8; Wed, 23 Oct 2024 16:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729700872; bh=2kqxFTsF0VpLKu0Q8ITzkkpCVlSYd1AaYO9X9gKSuRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDBDDy3Cozej4cVeJS6VdrDMmuAcAas3v6qmEhUpt02qS59WB3sPka/6FmNKq6hNL oxK9VnZTVtD08XyMqZ9lHNjCQ/aYAQKvwxZ0RUNf8vO2kNesBdhhOmbOAUzYBH/Eh5 MCPuTLJbMPWYwhlnKISkcpX3Arrcnd7O4X2MKAeBE9DFU7G9T9XukhKiqd2/ysc99y OgiyK15NKezrZVpD0Ip3sn54VBcGXjUuv97L2zwniRduPDAfSvKRGdqYESbHNWw9rL UPYQRJhm64zUAPjm0H1w3pwYaMdINtTOG1/UifahZC9Fnk9jpobk+Crque4Bvms0Lc bzehP3zA+L30Q== From: Mike Rapoport To: Andrew Morton , Luis Chamberlain 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" , 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 , Suren Baghdasaryan , 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 v7 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together Date: Wed, 23 Oct 2024 19:27:04 +0300 Message-ID: <20241023162711.2579610-2-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241023162711.2579610-1-rppt@kernel.org> References: <20241023162711.2579610-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 06DDB8000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 89koduzc79xtewzgte1pgr9tysxqzpj7 X-HE-Tag: 1729700840-20764 X-HE-Meta: U2FsdGVkX1/rRNhKQZtPRr/ycKajmxQEkJb+V07KaHF6U6+872Xl45cA+6IiNUE4kFAlfjRkFGZ0/dBolWkXqfV7lYNa3yQuZbL22ZtV2P8kmh+oMvbttty557wuGlzzzfwhxyv3d280Zfu3yGU/nhsuN1wQLhSc5KGdP3HsYodo4GUxq3ykduKkI+tYro3NW2OBIWR+dmwo0+NiBHuZfA8c5PSGYbCTO6FNJUh2RJFuBNdw1mMOMyZbIbknRb3VTQ8SQKAjxG+uDpKtHdVN/Zge+QaXJsEyc1WlPWxwF6QeUdlgmqiJZ5fpy6NT+qlm8BnDsUXi5fxrsFFu2i4D3imaitlNFZY2kEm5IKyO9SSPeBMCu1lsLVFzA81fcsfdf8iB/fOC75DCIOr9p/ghp//YfWrXAnggEKFnzuwE5RSlsgApfYNcwPPgilyHz1i+B8Z5RYRNO0pHtHWlOpLqGEjROHu7QoVjFXm2YcPfCt5BggrwmfTUmQujswkVxwwjK3Myg8OKN/tQgK3ceZwO/OtbAoRsozlC2mjNF79xO4kAFEydQoDLn1lfFZLueL29+W1BcFPeJyRIJFrb6giPUUJwwcRUSwsTOck2HViSuGCT96LRVNxK2llllsYKXAH6QMFjzex09gqv3TZUVL+lp8m3Y+8/Mc5XLLN7HWFxwCy9oAiR3X0yezTeb+px9hIbniNo5jZ9FukjhCuiwP90Kdl5RGpFdCuqyGect/w03Hyq5hCmSt+4CpAPTGV/EyeD+n9lp0SLjoq2Kjacm3K+hd+m6fWYVSdlliodDsFemos0fq2Gn+dzcGpbBDVA03tPBTh8z67huU53WxvKfwJq7FqGocql/umMV+Qx9/uJf8Oke0vkhv+T3/U8DFCFITF+s9q7Whq/PsiJEAu89V/3ft8TI75416IJ/9TW67Fla5yxGm6csYF1emmjrdVD0+b3hBpuO73yIJfiHADqT+m TontMVZ+ f7eOAblCMUBG8zE4QzzkbuVEfui0crb5KA8/EtbxPirE8QjN2bfWX/02Kqclk7u3k37+aCvN9SPcK9/N2NTr70WYaGMHxQXy16k/d0Mmd/aSgWcQONI09hxyvYKCp8qHStA2vCvK41ww6B0CYlirHtRc6vjEmc+UIJ3Wvc+UVbn68fsNacY0qoLPu6iLjborv59fmILAkUHTy2OPjBHNKC7juvC/qHc/6GZIzkFTxjifxZRh0IR2i1S7GlG4SQw0z45GgnK00ija7CsG3e+xqa+/ZtG5DcThD+JXdOjV6kvpyFmxyyg1xyyhJfw== 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) Reviewed-by: Christoph Hellwig Reviewed-by: Uladzislau Rezki (Sony) Reviewed-by: Luis Chamberlain Tested-by: kdevops --- 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..27408f21e501 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 */ +long vread_iter(struct iov_iter *iter, const char *addr, size_t count); + +/* + * Internals. Don't use.. + */ +__init void vm_area_add_early(struct vm_struct *vm); +__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) + +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