From patchwork Fri Nov 22 20:38:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bijan Tabatabai X-Patchwork-Id: 13883607 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 E43A2E6918F for ; Fri, 22 Nov 2024 20:39:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 740A96B008A; Fri, 22 Nov 2024 15:39:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CB7A6B008C; Fri, 22 Nov 2024 15:39:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CCCE6B0092; Fri, 22 Nov 2024 15:39:00 -0500 (EST) 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 234B96B008A for ; Fri, 22 Nov 2024 15:39:00 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AA9D9A16A4 for ; Fri, 22 Nov 2024 20:38:59 +0000 (UTC) X-FDA: 82814894610.02.9623118 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) by imf14.hostedemail.com (Postfix) with ESMTP id 4E12C100009 for ; Fri, 22 Nov 2024 20:37:57 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RJqUnx9D; spf=pass (imf14.hostedemail.com: domain of bijan311@gmail.com designates 209.85.166.169 as permitted sender) smtp.mailfrom=bijan311@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732307688; 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=+Nas8eIV96EE2tCIE/RR89rZ3FmEkH4A6p7KtVBi+ag=; b=22GsF7gBmVnSVS1KjWTL7an0w6OGz9sgXkLR+JIo9ZUOcYGbzy86oO07X/ywlsJ/S8LKx4 SXrXyI1f/0XEstjiJRYkm6s+FJ8jRZlqgtaZLoyTQKWDH0FpV4UOv2aBr2Hg6eQdd1C6RT QnXg9SGJD3jI3EtKeWvf+reSy9gIPF8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RJqUnx9D; spf=pass (imf14.hostedemail.com: domain of bijan311@gmail.com designates 209.85.166.169 as permitted sender) smtp.mailfrom=bijan311@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732307688; a=rsa-sha256; cv=none; b=ei5AY3NgjhLpyI/4kJdSNWUSjBmi6U7MG1uqSlhwlX4v5Cbc8BlF/A1TRbDv6m+Gso/DIH VvcehQiggg9vZb7PRKQhFkBXgHTiinwLbhrvAJkGsK9qTPIZgQ8AoyA03OdsQ1Nvh4q6qL VXW9QZic/S+QccvDvvxV8MZQ/qdeU9w= Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-3a775b207b4so9794445ab.1 for ; Fri, 22 Nov 2024 12:38:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732307937; x=1732912737; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Nas8eIV96EE2tCIE/RR89rZ3FmEkH4A6p7KtVBi+ag=; b=RJqUnx9DacwWe/YiUwp5EOVhMEkzANiNOxXiNUVV8dmGW+Zxh9YQg7idAxiCcUcBIB FV0K9kscp7kMjvga6/VpzPrg8AhYKgjMbW3WGwX6zeNLUOBVOq3nMyEjKcswkljG4Pn3 cW+bmZlPCDfgMSnNOQIaASCW9Aa4Gy+zelwGuQBTJOEY/MhSVhKdmIxMv7FkdfD2lc7x dWqsAGSsxn9+MP0WB4KC79uqLA+DWQ4u2lmYSoPx2vYkNO4cyw/pUGQoaf7QRjZMRiHe 6OOAGzsJE67HDxbQIq9WgzHIqdR7qBhs/NAxpMlpvii7U4BA2I+juPGI9mS2f5yEKz93 QrhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732307937; x=1732912737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Nas8eIV96EE2tCIE/RR89rZ3FmEkH4A6p7KtVBi+ag=; b=syBtm7MOkRAzf9LCs2P91aQOsd81OTsAo5H9SZDFWK5wnHhVtDcN7L5A/xwzVMr4+f 08cQzPRWR9YzJo05UqUvQ1p0dl/mhiUQd/VZaLsHntN9kEyhxIhzrSpCMN4ClPyro1BX 1xAOQi4W9P1FmvTVWUwCzJiTbJHSoeBMQs+z4CSgxyRzMr1LKHR1od8nLFQxECnYg4/B wuI9jhB3PfBbyJNd4PR0HqnEL8a1raHnFT5/8ruoI9A6UUwF+g6lQpXGU48a71hFS+X6 bgZ3rC1dnwVMerHi43BuLKQEo8zXPzfAHJhQLeXr3J9ImShsaINiQ1T9zWrVuLZQcqKD CjyA== X-Forwarded-Encrypted: i=1; AJvYcCVWbbPUTM3Nm6AJANX4Q4Jl9gIJpqh/vF757q0Bekya6WN6NHL0I8tw8ZTfQZtGfM0lbHasZCnjng==@kvack.org X-Gm-Message-State: AOJu0YxOGeZU3ucnC+/uZW60RrqmdCMYB1OF6WbRnmWZml3Weeecqal3 4iNeNMio0Ov87va5v2lYEofd8TDrZGpGqNAgnt5BxoQyrODW8vVm X-Gm-Gg: ASbGncvKK1OCyeq6obQbPz/mB+GGzkF5RWzX7wQJmp3uvcPVU82F4fd9H8xtTIuLIwv k8N8ckqTxH0iKs3hZdX5pMoNlxQoXd9sVAdt7utNoBDd75n0djZNROCgoVgOO0+7x8LAE6bTKum OA+oDzYPpPjG1ZR7eGhy/KCUeajM1Ivt1X+qWnniR+mMRuMiM0oWIrMjK3+phvp22r9+YmCHNkP gEgzI+iZr4VHRha0YDgAP1NBTT588/zB9+spEuDHxiclMbsDFUypGdx/imYdSC3/fiqmu0E9gY= X-Google-Smtp-Source: AGHT+IH84ZXuguW5NeIKMjIEW1e8CTOIrQYKEK8pZg5bmF51hPpd6+LMDLkZbGnKlu+xUy04ChImeA== X-Received: by 2002:a05:6e02:1a08:b0:3a7:4700:7c1 with SMTP id e9e14a558f8ab-3a79ad748f5mr52242395ab.12.1732307936778; Fri, 22 Nov 2024 12:38:56 -0800 (PST) Received: from manaslu.cs.wisc.edu (manaslu.cs.wisc.edu. [128.105.15.4]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e1cfe52506sm794682173.77.2024.11.22.12.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 12:38:56 -0800 (PST) From: Bijan Tabatabai X-Google-Original-From: Bijan Tabatabai To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, btabatabai@wisc.edu Cc: akpm@linux-foundation.org, viro@zeniv.linux.org.uk, brauner@kernel.org, mingo@redhat.com Subject: [RFC PATCH 3/4] mm: Export functions for writing MM Filesystems Date: Fri, 22 Nov 2024 14:38:29 -0600 Message-Id: <20241122203830.2381905-4-btabatabai@wisc.edu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122203830.2381905-1-btabatabai@wisc.edu> References: <20241122203830.2381905-1-btabatabai@wisc.edu> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4E12C100009 X-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P6bN1BI9CmerX3bSwOfU7+CbZN1JXLmHU6vM7zH0/4QFPHiS3PSgS9TpWTV+kg35oFgcoNMu6za1dr9s5NnJJN2o3LYaE0Md/nW700NbBPZ5pcZK5MYG2lQW0nNqxjQagCAoUWQ/tFk92xklhsB9fa4gY/TWz1FaPGLx+9zMvczJ9pm3mKw/kJn+sXHZ3UPukUijGNGMX90pZn/O0Fd3DuwnA8h96JUH32ZRqLw+E8Oc58q4ViUVdwmaxeShfw1ex0KbW5548LRLcUX5Do2i+8dFsYf162N7eWg== 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: This patch exports memory management functions that are useful to memory managers, so that they can be used in memory management filesystems created in kernel modules. Signed-off-by: Bijan Tabatabai --- arch/x86/include/asm/tlbflush.h | 2 -- arch/x86/mm/tlb.c | 1 + mm/filemap.c | 2 ++ mm/memory.c | 1 + mm/mmap.c | 2 ++ mm/pgtable-generic.c | 1 + mm/rmap.c | 2 ++ 7 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 25726893c6f4..9877176d396f 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -57,7 +57,6 @@ static inline void cr4_clear_bits(unsigned long mask) local_irq_restore(flags); } -#ifndef MODULE /* * 6 because 6 should be plenty and struct tlb_state will fit in two cache * lines. @@ -417,7 +416,6 @@ static inline void set_tlbstate_lam_mode(struct mm_struct *mm) { } #endif -#endif /* !MODULE */ static inline void __native_tlb_flush_global(unsigned long cr4) { diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 44ac64f3a047..f054cee7bc7c 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -1036,6 +1036,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, put_cpu(); mmu_notifier_arch_invalidate_secondary_tlbs(mm, start, end); } +EXPORT_SYMBOL_GPL(flush_tlb_mm_range); static void do_flush_tlb_all(void *info) diff --git a/mm/filemap.c b/mm/filemap.c index 657bcd887fdb..8532ddd37e7f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -269,6 +269,7 @@ void filemap_remove_folio(struct folio *folio) filemap_free_folio(mapping, folio); } +EXPORT_SYMBOL_GPL(filemap_remove_folio); /* * page_cache_delete_batch - delete several folios from page cache @@ -955,6 +956,7 @@ noinline int __filemap_add_folio(struct address_space *mapping, return xas_error(&xas); } ALLOW_ERROR_INJECTION(__filemap_add_folio, ERRNO); +EXPORT_SYMBOL_GPL(__filemap_add_folio); int filemap_add_folio(struct address_space *mapping, struct folio *folio, pgoff_t index, gfp_t gfp) diff --git a/mm/memory.c b/mm/memory.c index fa2fe3ee0867..23e74a0397fa 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -448,6 +448,7 @@ int __pte_alloc(struct mm_struct *mm, pmd_t *pmd) pte_free(mm, new); return 0; } +EXPORT_SYMBOL_GPL(__pte_alloc); int __pte_alloc_kernel(pmd_t *pmd) { diff --git a/mm/mmap.c b/mm/mmap.c index d684d8bd218b..1090ef982929 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1780,6 +1780,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr, info.high_limit = mmap_end; return vm_unmapped_area(&info); } +EXPORT_SYMBOL_GPL(generic_get_unmapped_area); #ifndef HAVE_ARCH_UNMAPPED_AREA unsigned long @@ -1844,6 +1845,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr, return addr; } +EXPORT_SYMBOL_GPL(generic_get_unmapped_area_topdown); #ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN unsigned long diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index a78a4adf711a..1a3b4a86b005 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -304,6 +304,7 @@ pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp) rcu_read_unlock(); return NULL; } +EXPORT_SYMBOL_GPL(__pte_offset_map); pte_t *pte_offset_map_nolock(struct mm_struct *mm, pmd_t *pmd, unsigned long addr, spinlock_t **ptlp) diff --git a/mm/rmap.c b/mm/rmap.c index e8fc5ecb59b2..fdade910cc95 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1468,6 +1468,7 @@ void folio_add_file_rmap_ptes(struct folio *folio, struct page *page, { __folio_add_file_rmap(folio, page, nr_pages, vma, RMAP_LEVEL_PTE); } +EXPORT_SYMBOL_GPL(folio_add_file_rmap_ptes); /** * folio_add_file_rmap_pmd - add a PMD mapping to a page range of a folio @@ -1594,6 +1595,7 @@ void folio_remove_rmap_ptes(struct folio *folio, struct page *page, { __folio_remove_rmap(folio, page, nr_pages, vma, RMAP_LEVEL_PTE); } +EXPORT_SYMBOL_GPL(folio_remove_rmap_ptes); /** * folio_remove_rmap_pmd - remove a PMD mapping from a page range of a folio