From patchwork Mon Sep 9 06:47:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13795958 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 71E84E6FE49 for ; Mon, 9 Sep 2024 06:48:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E52B06B0115; Mon, 9 Sep 2024 02:48:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DDAD26B0116; Mon, 9 Sep 2024 02:48:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2DBB6B0117; Mon, 9 Sep 2024 02:48:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9CF966B0115 for ; Mon, 9 Sep 2024 02:48:13 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 15CEB141E4A for ; Mon, 9 Sep 2024 06:48:13 +0000 (UTC) X-FDA: 82544270466.24.1CFD0DD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id 6D9EF1C0008 for ; Mon, 9 Sep 2024 06:48:11 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Gj+lzttA; spf=pass (imf20.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=1725864464; 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=g+G66vocjYIIshm23DcfYZ66lJd2neaNpbFmzjER/DKYRMU6YxPlDQ1zkhm44lrnM6zq1P KMGbJZ07mh6D9Df+xbSRgsCTGb1MIauvxidmMU1EEPQGdVBFj4VeGEMj6b7vr13mGWuKNf kG3uzOJlzbHmYcUqv3yT695DjUIsBYw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Gj+lzttA; spf=pass (imf20.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725864464; a=rsa-sha256; cv=none; b=pwtCg7r0tF6UFQEN2FK4bxKnszrEzDSTOUXoFbnu9X83zoEnI9Wt2LqwBvJ0TrAUDGN8q1 5YM1oOIRutYjnZzrp3bs2P44JaDQhmypTeN93t8Om8uGrDVwt4GSLEaVjUIRGHgcR2wRuV 0wsXigNRtATgH88e6o5Xp6wk3XK17oU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 12C905C555F; Mon, 9 Sep 2024 06:48:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CCDEC4CECC; Mon, 9 Sep 2024 06:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725864490; bh=1IVaPMd4I4fDfGF1ACfZ1lO9QxF1trpdGcxo9QBF4dI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gj+lzttAA5oSoV5Vb9da6KE7xFA3MX3gF3n4fs/Pu82TFZ4yZBYL4hkjpjHqKI6id GQFcdurzlHpJRWSFkagKeO65o2mvCvJr1aNXR33BED/KUmD0PA4kHUjW6yw9wu6Q/x UWzF2omUtV0ihTYSG7qcNP5ZHb/04Yp2U4P5f9UXvleC4UBaRsXMvJYF7XvTMcmuH6 qru4oHu/5m1jyYbalrUaQxR1ezKxywSshOwuHA6+dt+8QxczQtesKGh3CbBSrtCNpL TEXmTc8rltDVQI2WI8kB92WFu3EquhAxTBuM16XzgDV5xctv5hBhuXdfF4YNN/tcgy iKXE+mCxIahHw== 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 v3 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together Date: Mon, 9 Sep 2024 09:47:23 +0300 Message-ID: <20240909064730.3290724-2-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240909064730.3290724-1-rppt@kernel.org> References: <20240909064730.3290724-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 681qry6qfik5zojsaaes8yqs9oszwnym X-Rspamd-Queue-Id: 6D9EF1C0008 X-Rspamd-Server: rspam11 X-HE-Tag: 1725864491-757935 X-HE-Meta: U2FsdGVkX1+2VoC1KInznbzIVOZLne6KvFTZBkTou9UREr5Cl2MSXqVhxWLcQYyrv/RdSQRSjojvJ1UBt0yqQTmXUS5qEpaGUbg8Mtxx0La2Axq9OVgvhQY7T5K1Du5zmGALxgPOm8AoIs6nxVrOzigaZV97G+6Owu0LO/0Nd0cPSLO1EhMw9jVBiH+RVtoONDFHH6e2QQpRSKNWDLqtZ5G1OEQQTW2hTXYJ6WTvn5r09y2bdGptFZLdUClSQn/C0jhwfYlsF5SAm60mNEqFtKWSculbTKipnI4Ks8uuUTban7qxN/fUXuEenrgae/bu42QopQXTzrmAuWcgO2/KFxwivLuK6+RBhS6ulyxKlb/lbFM/oEyyEfVNxeVRA9WZIRF+hCVSY3zeetiQGbhxHC5ih9X5g1RYQCxJ96PDJL8pFTuhdyW8MjxfWHP/6W2faLfpSe9U7HqPH3WkHATLvnHo45t928igCsMqekwW9R8Jq0PcYTc2jPcaGkduV2Dn+77/a42sIaiS8xxFoVyn50wcs4bsg5d1ePOKEsDa0gV2eC9HGjrfYSiAxLE0e5/vf2F3UzGPbA9RJdzj62DaDNpeGX7uKm1Ot0731ElptiRY1Hs6+GU1Zc9adpSgT4s6eOVHWiImKQrYdkHCmEJAQac829T9tRKWKadRKfL5LaG+d0k+PYKCdfKxka7nj52xNTOH+AzlEgOc36xuzWOCYxlGUjTqwRbOVKh/l+lnP72l8xkGe5lm+28yTY7f94vwmnDFtusL9mzMxg5zgKLMQpFGi14lxxBKhjJOSAGDK+8ONu0UHJQEbF8Qin4TYvEWpf8nWDvYHmut4zMoNvKnoIEwkfkvrHqMk0A4N08m8Lo9T+cdjGmV61Qqa9/QzMlAKUDa5eO22lsdS9FkzRAJEuQu0Vb2apRVZcccEAMdYcsBXgeGlWG3MQm82yDMZ1wdPdHcEDxu/hzn+9ScoHy jCaziTX5 Ouqs1lFHoDDgFOOVjytbijn/aWixxgpivCLlSUFlOogQML0o1jusm2jPqIhBCWSdEazxWMt3Fur01ZsntoI5doB9rGNmsa+l1sOK5YMwfGV1iflylGC4+oVn5z8UzKm6wc1GYxrEq8dK7c84fMo5dNTI9jTTARwfHKXJESQ7gJ9VOwnOgNyQjRoq+2nZdVKtu6b9eqN6DMXV7MOAxAT8IKYcasB7ehdG9lCPLyHlXJGrvVHF8GdXB9iprxjiSXgsARMMev71+eXf9eNRWOh5xTExacEX1f66cB3JsWldj1W/LRRQ= 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