From: Bijan Tabatabai <bijan311@gmail.com>
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 [thread overview]
Message-ID: <20241122203830.2381905-4-btabatabai@wisc.edu> (raw)
In-Reply-To: <20241122203830.2381905-1-btabatabai@wisc.edu>
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 <btabatabai@wisc.edu>
---
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
--
2.34.1
next prev parent reply other threads:[~2024-11-22 20:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 20:38 [RFC PATCH 0/4] Add support for File Based Memory Management Bijan Tabatabai
2024-11-22 20:38 ` [RFC PATCH 1/4] mm: " Bijan Tabatabai
2024-11-22 20:38 ` [RFC PATCH 2/4] fbmm: Add helper functions for FBMM MM Filesystems Bijan Tabatabai
2024-11-22 20:38 ` Bijan Tabatabai [this message]
2024-11-22 20:38 ` [RFC PATCH 4/4] Add base implementation of an MFS Bijan Tabatabai
2024-12-02 15:56 ` Jeff Johnson
2024-11-23 12:23 ` [RFC PATCH 0/4] Add support for File Based Memory Management Lorenzo Stoakes
2024-11-24 16:53 ` Bijan Tabatabai
2024-11-28 10:22 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241122203830.2381905-4-btabatabai@wisc.edu \
--to=bijan311@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=btabatabai@wisc.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox