From patchwork Wed Oct 16 12:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13838289 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 F0514D1AD51 for ; Wed, 16 Oct 2024 12:25:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 786C16B0083; Wed, 16 Oct 2024 08:25:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 737066B0088; Wed, 16 Oct 2024 08:25:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D7726B0089; Wed, 16 Oct 2024 08:25:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3CC0A6B0083 for ; Wed, 16 Oct 2024 08:25:09 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E83DD40232 for ; Wed, 16 Oct 2024 12:25:02 +0000 (UTC) X-FDA: 82679384886.22.D26CF54 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf14.hostedemail.com (Postfix) with ESMTP id 7B22A10000C for ; Wed, 16 Oct 2024 12:24:57 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BcH3WvKo; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 147.75.193.91 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=1729081362; 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=7iUEgLxXdj5GoIVN2DF9yn4luTvHsrglzb6yo8KsCNY=; b=2ChCqF2XO3OANvYwYX/PBbeorjaQIEw9o084Xx4deRJINtAKgr1f78EUSNGsUpBFLe45hf LZ6KxJCxtNJ8RWm0uPg4zuiVV6C38UoPmDm3vJzzwRClfgr9CV3h4jnp5uS2C9wK1ZloHH CQ+zfMFHQH+iXP8rdDBjgdCW/mfLhc8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729081362; a=rsa-sha256; cv=none; b=qfatMm0TphzvhsSnWKeaC44RAlz/KsfdFDTzv5PaUejUrKLLJsHO3d492v5Acbl/1beB7I /X5ELGszYfbjOX+uXuY2XWS0zQAG8kjlXxvuj4obxYjTQOxr9EqGIEhL/ZRcay5JbMQmdd oHVjWvuoefXt+Bra4DKmpb/hsptvlaY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BcH3WvKo; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 147.75.193.91 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 nyc.source.kernel.org (Postfix) with ESMTP id 5462EA43CE7; Wed, 16 Oct 2024 12:24:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B63D7C4CEC7; Wed, 16 Oct 2024 12:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729081506; bh=FhExyBVsAa8DlJgV7GRUKfpMvTFVrG7J2kadpMHGjFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BcH3WvKoF6eSdLcu4KIL/oX1Tn7Y00nHxcTsKKWYyMhF9lKJ5Rzy/RniwiJvC5IzN 8ZlFCX8WzT5Wb0kNFn8LgRpXf1T8rscmfk4ykinUu2pKTXxkoRcKsXCFa3dLeOOfAG JpGLnl/bccMCxeT6gmfx7cWriUR2ynzwEcFbGe1Kg3+JJGrZvDWhsXGf3IT/OxPscB uD9d2jKY4rQJ6OXg6WCpLiKcrlefvCl+X5uJ5pyBZbdhHrwyI8cqmgKIvAG/pJZCDM cN+rAjVtvS3z38VZ7RG7nnyqR3iHZvGmgdDqgMwHTHZaGcdacC/fgISxxq+Mq5rM/a HYujkF/kPCdxA== 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, Christoph Hellwig Subject: [PATCH v6 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together Date: Wed, 16 Oct 2024 15:24:17 +0300 Message-ID: <20241016122424.1655560-2-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241016122424.1655560-1-rppt@kernel.org> References: <20241016122424.1655560-1-rppt@kernel.org> MIME-Version: 1.0 X-Stat-Signature: d9k8nk5zpciam9fasy7uuiw69t1qhrkx X-Rspamd-Queue-Id: 7B22A10000C X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729081497-703745 X-HE-Meta: U2FsdGVkX18fVItIUDdLHkBdrYz67K4Z/QthmnpAXhCZSEu3g3BxL+yhOjW6R9xTg2FbHC8rad0SuvILGsQabqxi3qFmEAZ7XyoxbOaAXM6bOU2FKzQfWYCS7AeaBYpC+Cj4ibxB4/7qJ50K7r8S7j/Q4NvIYrIiEUFVtn0ydSf4p0lGqN8qxVWgvpaAqcSQ/7OHVAXFRpiVF5ezhZk8v4OZdoBoQEgVABN3kxwmnqHYvZpqd7ygxD6XunPfYVd60SxyJ4HCpCNeIivU0tyqVyRVbOVIj7nIHvdPrdspkvWanxtGfmMSWTGiHYIpR61GLO8wdn8IgOKMzjht01TW/sKwzW7omlH0dPp6VKB+HvMjOwK2x/sPqe4CF9pOvX1pbM7SkAH2Q7mEhx7RrN85xu65o2DKhM0SBTGLSuKXzsXsMEIpPSQ13jaZm9VB5mFwR+NkpqDkyfkhxrs5wBNzrYOz3kes9LqZgnedKdHeft0EoY6RPLnMeGWP6+a4GOqVlAGiXbibHty9DKbjpI7wTtplPSRbsi97nultCgNFUM2fmrXouifutl5KP2AKM3bO97jbvG4Lq0RAqAh8DLKuqPiSCRxj+84J7He6B2wCzrWeHh5LAwFRwoJOoU8r2zNPdyhBG27vXCgoV1+8kEyzPDmZkF98r48RqKeRfxtjMXmY21yh/c+zlaIrXfvKWPhvyEI7LWXKC8GbXYF9k43z2YyOQOH8r2GvuPHP3fP7Y1QfUZ095TuGyRVyOBydytm5Xh55fTXuSv4Lklod531aACgq1GTRl3IF89+4++9W0hXDc/n2JVYzXFMyuFvd8dkdCgstbjznKwvwJy4342PRq2gyC4WZ5ZkpF8ESbPFRp/RS5uXqDqGLhZaXV3gNru5QJcogr0K4/zwCTcJ5wGi3xnaSgGYP1+RnltfRa3r5T6FhBzUf2WYu0X/zzlnGiV5O9Gw1JQfdvCQkgC2Hi7F DQDzfmuO L7koT4LaNwLaCG9WFZbDnnleYQQXS3gzEKxdx+FOq/4p/sgjXWD+RAjAJ4yjcu8/qB2RBZPRZvhRebAKUjk2lZMvKYw/AWjhcSypFxgwAurx0KfzQ7clm6/FgPwm9mJ9wMOmmg6Br944OLAtqGaXZTM4y4aK/DD36htKJ1cgi4Qt/taqcxcIB3eVO+pSe4Tu22poITPBwlwhs13BQMESLM6BN3PmWTC8kqTA1Bc2fL+4hdaiJGyqVDzGtOdrd5G0AOst70sdkt34cGOeEiGBABnhE7Q== 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 --- 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