From patchwork Mon Aug 26 06:55:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13777235 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 110AEC5321E for ; Mon, 26 Aug 2024 07:02:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A07E6B0083; Mon, 26 Aug 2024 03:02:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91FE18D0029; Mon, 26 Aug 2024 03:02:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D5126B00A2; Mon, 26 Aug 2024 03:02:27 -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 46EB26B0083 for ; Mon, 26 Aug 2024 03:02:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 051B5140CAD for ; Mon, 26 Aug 2024 07:02:26 +0000 (UTC) X-FDA: 82493503134.15.1A371B7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id B34291C0019 for ; Mon, 26 Aug 2024 07:02:24 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eEXWu1rK; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 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=1724655650; 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=LxF225/K/unP9JE6t/pV9AyRKMos1QHjLabCCQuOXXY=; b=5bG0RW/SfIDxWH/D8zrtzydJ6KEk33saDN0q6oQSeLx/bQ4iuoiqdYWEia8hL8nrocqgwi q4V9IVOW3yKDPitfnTvd4bLO5bGg891LsN27+4RJ1VB1+XAEYfm0lkdMlVN7HZK/JBQ5PL hCgESma6XQ1QxKpV/AjHZeaZsG9w2MM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724655650; a=rsa-sha256; cv=none; b=NUNNOoddDiiFQ8C+Wqm7hhfL6TT8ewUXcav+DYM7uK3NHAkiq3gbRXtuWo4hxVIXVFl0Bv plx9mMsDMTsijfa6fG9gpclwObhT9byESisRKzLoxeQuN+Ce5+C4HqrYCvJg14eunXgF5M 1TA7ijLEXcwRsJBb26cTYCFZwwoARN4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eEXWu1rK; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BCB08CE0D07; Mon, 26 Aug 2024 07:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7310EC4CC21; Mon, 26 Aug 2024 06:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724655371; bh=1IVaPMd4I4fDfGF1ACfZ1lO9QxF1trpdGcxo9QBF4dI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eEXWu1rKRnZ648Ah+x/1BHnotq5Ln0fHqGprrk/r5JBNYEHatBGvJrJociOpwu76B aZf6asJPDlGZg/jbjaINxlgmRQgSqtzNvMEGQW1yfKDx/eRPw4h5498wpkylKQMGwF 6ik8WsFe6xb4iUQGRa6QVkB48hCx3+0QVmX1P1sO40K5nOnoLaCUvsYe9tt8SMyXJN NX7HI9ihImLp5tA/BMIzq0nTRJMAdNRlk5OyHkilumvLHOyzu3rzeAoFqtfiiRbQqp qizWmDiaWIyxFsVcbhSIUXn1ghK+zdzLlqjG04+bjJA0HiiGMEo9ORCQvDuCHXAmSr KUgJwhh6Ckf6Q== From: Mike Rapoport To: Andrew Morton Cc: Andreas Larsson , Andy Lutomirski , 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 v2 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together Date: Mon, 26 Aug 2024 09:55:25 +0300 Message-ID: <20240826065532.2618273-2-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240826065532.2618273-1-rppt@kernel.org> References: <20240826065532.2618273-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B34291C0019 X-Stat-Signature: ft1n7dqgxtkfhmsohe1izwda8sn6619a X-Rspam-User: X-HE-Tag: 1724655744-522756 X-HE-Meta: U2FsdGVkX18JeN7R9E8Tr/j0T64nRWMz72/v78QAoc+Ah1VWLGIkypjJ+iq1WvdI8DYKqHQHmi7E4HX6FSjfzXXpX2huL5SL02oRRIIobQ2/Jr5Nq3/lWINfJGO6R5Z2/kkSGvU1ILp7JhDDuD90DBn/U4VWbmxIDttgEtMzGFmiAm6OxvVMA4FhLv87Zm5zKIOWFnCKnoWyl5u1m/w/eDRMzFbkNHY88n6WMrkHCxZtrAIwlnE6jO9bqgp50fD7+jOi7lVo+PuktjdyIBQHXDyx0Nu9VlT4DolhhL9yrm5cWZsTETyDEPDf6F4KlYiETvGRCpk48rx862sggEkTliYLCa4/teuHRu+LxH5UgcatfFylwIgnCvzVdKQpRkypzWh888w/gFz+JUmLS/0tpMjNJfMR8kLKE8bdqXUvklCSFkrr+hKtpUFAlOrCzTPHLppmS8sTo6mX1gUQ58pMAid/hIBaHq3N28eaw/lfvQrQ8JnxwW2Q6nD+QSQ4pLlK0zReFcO3t0MaybCc9Rdg1fEZtJS34wRTev8+7/ZrR8d1n5p888KpJcDAOQbYdfGeShzzsFhN/BtZCYNe0WipWd1nlBzI/QIHmRFNcFhRFHRNhyGjImtopsjnKOTUf6aIO9tpkNwvqF0u9SWEEjkGZhcW5gIa1Mx9ozm1uGaQDAYgPZNtQggEc8EjN55MQ5xMCbOZ+QwY2ia/LW6eqRLySVhRm0BCABS/OkP6dwA5vqMtZbD0x+gDZDMchXnWxdZnr+v7oIjiAeGqr+7XfICw5S8AiB9if4pdTzcDZjDabuPCufNziPatdN+Rs7Tt/vz/IPPn+McF60bliZFxJWQGoGreOmubSP2KqZMZkFAoyW2kNxqs9fjYAwjusnYgzS4tzUq5UnyQ21nu/Ucr8IWZLjj/PvTDG1iS3a/ptYlG0o6adHCGJxgwV989O7ZMa7d1cm0lKr+2ui1EPHuq1B7 7Xrnd5B1 /D7ceKynlAViFe2es+DuoVklatyME2uEcIfTQt4RiK+E6SoeLilYxS2dZqpfXblWUYMkTluOS6Y8lDv4K2rnEIHht1zTmjj8/dOVfeD7rJAbp8OKROCPPdVijIodPo3iL7y/GzMOXmpVExM7/aXW0NZi8oJimau8zoFwdIzXW2bsUe+/0TwNc9RMM0IK3ayINjhsmNjdnq+mCzDVcytrx3eKHCBhcGhhSw6Y4NKWBm5MXFRfopR7Z1uLeayxQMFh8BHv+JPn4YTSyWMPZ8xlxhqW8fMqUGC5Zw3MC 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 e4a631ec430b..c614631a31cb 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__)) @@ -262,12 +256,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); @@ -275,24 +286,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); @@ -307,22 +308,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