From patchwork Wed Oct 9 18:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13828972 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 D255ACEE339 for ; Wed, 9 Oct 2024 18:09:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CA5D6B00AC; Wed, 9 Oct 2024 14:09:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47A566B00CA; Wed, 9 Oct 2024 14:09:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 342826B00CB; Wed, 9 Oct 2024 14:09:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 17B9E6B00AC for ; Wed, 9 Oct 2024 14:09:07 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 59B2CACC79 for ; Wed, 9 Oct 2024 18:09:01 +0000 (UTC) X-FDA: 82654850292.24.270E28F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id B61EA20010 for ; Wed, 9 Oct 2024 18:09:04 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EtIHaeJw; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728497208; 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=PeqocIBRinWb9CnpeGryRUtN9mNVTMgsO2JsIINQ7QOwOTSSaVJx+0QTsDChrQmzZPxcwF 9OCuEamZNkQiMb39xt1hjnvAmHv6zfMppH0MV2PjHRh39oISLmOAC1C14+072BFBmUana8 4l34wQkCEvXz/mPbxfOFVWGiiaaIZlo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728497208; a=rsa-sha256; cv=none; b=IAamBMmJg8sPt0gIwad3hQLgmfvR146UXsmII+IkpNwyjGSOXS18X8NiHQRWaqme6EvlIa xmsMjUuRly/lOEnypgIpAzWeitkS7u2pw8w09uBNBespZ7m7mZbzECsd+zwStunTSuZBWt HqQ4W7Psr5J11N/zi6/KbZoU1GYBC9o= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EtIHaeJw; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9BA6B5C5615; Wed, 9 Oct 2024 18:08:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D9B2C4CED5; Wed, 9 Oct 2024 18:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728497343; bh=YllkjQvsWrr6dQbJlUjRUABqghggyZA8loEEeE76mk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EtIHaeJwWAoCvtdCbCxK9EeVGERQLZ46T6d38Orf178juX3xbiSVV8C3zYclZ4a3D iQGTL7fyxijvASXlADNp0ip35EijAZNvymeSHSlBE7F8/8U3Mq9Tuxp8gd8Z53SVKP jQyccxNQ7+RAC8iWXR6z8qN0YJsNLLOZQt2zaftoVyBlufZugSbmIopLnXL+TWEQ8l N+2zP4nbxkV+aY4tzK+NbxMTpI7TBse9dp+Uk4EIirxkfVkGCCEWl/7ZBwXGJluB38 3RWErEhT/fiA5UNNDAn1/JNzpTyjVpUE73YLkc9wCI1OJbQMDeJCSrnnfCiQEcJMPY Zt9wg5wAM+50Q== 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 v5 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together Date: Wed, 9 Oct 2024 21:08:09 +0300 Message-ID: <20241009180816.83591-2-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009180816.83591-1-rppt@kernel.org> References: <20241009180816.83591-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B61EA20010 X-Stat-Signature: jdqg7qgjnfgn948gbnpkxkkh3kbasuq4 X-HE-Tag: 1728497344-502321 X-HE-Meta: U2FsdGVkX1/KnDBhX0yPlk08WzhVO+e0zv84iS6lfAxoVKaYg9MeMMc/FGwTaKQMIPJd0r8Qc+U2Z18urvxgE8xPdm/qLaXkk0HGird89lUejSRx61JKvF7+h//6QFPRnKqqMEIf9WnZGZNhgZXC+eUBDrdS0JQwAGLyTdDkU8WhKsL9BQ1NngOot8GspWmNxHuqYDQjV/nuf5IiJHYh7Bqlc01PBMjvppZ04lRAFR0uyZh+Q7HFnQaRPjJH3pR6OwjaSlx2r5WWVVsjNI8yyTQqlyfQ+xtr64pPVzVipmh530u2zydeZ+uqNH94uJpNlgQG8hIRX8p+r60xFldcz8z1WngzxspocNNp7Z9XlQbwEWFmlaAFgoO1PP1RMPqxEQGjHewMziu6xGv242s6Kl71lEqLcKc+/U6PU9+kbe6Ln3rOZVQ91k78JHyTDQFOkgGUaQX3x+C3LWUZolOEZ/4WwlYmqsBm24T4/h92ubvMJNjMnyV/oBfrQOygUvk+7BkhNxZXyrROEVulvcKK9oW4EIrkiUqLN3Xc5LUyLbmdXfEH4Fuc5F2L2J8kbZWvEsenq+OPSuALLXdc7d8yX4bxK/gNzSbEMMiFQ9qihKd4dax8N7zVqsYHuTadzE38MtrUZ7lNR8UDNwXvIkaDzxWiFYORFaA+ScR7Q6s3WSOtcxvb/xd6tYC9fB2tNwCRKY85/VOmJqnDmi7Atcx2mQOCEvSgORtCN2ofxg3RexBwlFsw8Jgc8qJuToBtVwPo7Oi9WcVDHtzq+L3HmvB9Jbuuj4uoWpKCIkdcZLWA40R+vQH/FTSk8Ir9LCdhfUJbibnGUo1HeZ9OhaDf/P4jzlB6XgpC2oEpw5xyoyeLOZshgANwni4m+K6hGeOpBI8r0UrOGIFSvO3ElfJcuwfsg/xJXDuZM7Dk5S6It6V8q5QZ5faJKaOn5CpaQvGEVskQPKo8XBjHQjdJjbmIapo KCoLNx8L Yirj90xclPuJM1S24x2iI8pL/rc5GNlFHQbYlWkKkAFSAuTAvyUsCKfgsgpPhjzrReMcp5178rfJ0AmVwove2d1KgK25jr+jic1YzXFrhSuxJSb6oDqh4yAbwcpInPem/18J+kKyfzbkHIMNTU8Kc2L1g2UokwvwgPnfCLLMhn5hrDbpbqcaF3DyyEigSeSa4uGDrmtdFORPQdnE9J76AmtqWgnAmnWkSnf5WJVtMwOtQ6evqRbmBhKCDfy6GCkXwbpd3vzwtLkzrOMU00elHXw1E1oyzf6fXeQ1MpdNT7hB7d2s3rrRi1h6hXeYbETUi7RgAtNAQ3Ua40iKrwrvDByxyCM5ZWdTbKgrkJ2gDzKMzsk1gziIC9X5+pZdFl98oBKXQ5cPVSOoUnCNkQF4HyFjFIQ== 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 --- 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