git: 9d41057c94bc - stable/13 - LinuxKPI: reduce usage of struct vm_page and vm_page_t
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Nov 2023 16:37:55 UTC
The branch stable/13 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=9d41057c94bcbdae8c7b8c9e8a064352da6fccbd
commit 9d41057c94bcbdae8c7b8c9e8a064352da6fccbd
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-07-31 02:03:39 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-11-29 16:36:04 +0000
LinuxKPI: reduce usage of struct vm_page and vm_page_t
We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.
This should be a NOP.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9e9c682ff3a1aec20a7e5f5b1dd88ceaec7c3950)
---
sys/compat/linuxkpi/common/include/asm/set_memory.h | 12 ++++++------
sys/compat/linuxkpi/common/include/linux/gfp.h | 4 ++--
sys/compat/linuxkpi/common/include/linux/highmem.h | 12 ++++++------
sys/compat/linuxkpi/common/include/linux/mm.h | 10 +++++-----
sys/compat/linuxkpi/common/include/linux/pagevec.h | 4 ++--
sys/compat/linuxkpi/common/src/linux_page.c | 6 +++---
sys/compat/linuxkpi/common/src/linux_shmemfs.c | 2 +-
7 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/asm/set_memory.h b/sys/compat/linuxkpi/common/include/asm/set_memory.h
index cdb7ad912acc..ae50148f0314 100644
--- a/sys/compat/linuxkpi/common/include/asm/set_memory.h
+++ b/sys/compat/linuxkpi/common/include/asm/set_memory.h
@@ -54,7 +54,7 @@ set_memory_wb(unsigned long addr, int numpages)
}
static inline int
-set_pages_uc(vm_page_t page, int numpages)
+set_pages_uc(struct page *page, int numpages)
{
KASSERT(numpages == 1, ("%s: numpages %d", __func__, numpages));
@@ -63,7 +63,7 @@ set_pages_uc(vm_page_t page, int numpages)
}
static inline int
-set_pages_wc(vm_page_t page, int numpages)
+set_pages_wc(struct page *page, int numpages)
{
KASSERT(numpages == 1, ("%s: numpages %d", __func__, numpages));
@@ -76,7 +76,7 @@ set_pages_wc(vm_page_t page, int numpages)
}
static inline int
-set_pages_wb(vm_page_t page, int numpages)
+set_pages_wb(struct page *page, int numpages)
{
KASSERT(numpages == 1, ("%s: numpages %d", __func__, numpages));
@@ -85,7 +85,7 @@ set_pages_wb(vm_page_t page, int numpages)
}
static inline int
-set_pages_array_wb(vm_page_t *pages, int addrinarray)
+set_pages_array_wb(struct page **pages, int addrinarray)
{
int i;
@@ -95,7 +95,7 @@ set_pages_array_wb(vm_page_t *pages, int addrinarray)
}
static inline int
-set_pages_array_wc(vm_page_t *pages, int addrinarray)
+set_pages_array_wc(struct page **pages, int addrinarray)
{
int i;
@@ -105,7 +105,7 @@ set_pages_array_wc(vm_page_t *pages, int addrinarray)
}
static inline int
-set_pages_array_uc(vm_page_t *pages, int addrinarray)
+set_pages_array_uc(struct page **pages, int addrinarray)
{
int i;
diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h
index 70c486002335..c5de09e896de 100644
--- a/sys/compat/linuxkpi/common/include/linux/gfp.h
+++ b/sys/compat/linuxkpi/common/include/linux/gfp.h
@@ -97,8 +97,8 @@ extern void *linux_page_address(struct page *);
/*
* Page management for unmapped pages:
*/
-extern vm_page_t linux_alloc_pages(gfp_t flags, unsigned int order);
-extern void linux_free_pages(vm_page_t page, unsigned int order);
+extern struct page *linux_alloc_pages(gfp_t flags, unsigned int order);
+extern void linux_free_pages(struct page *page, unsigned int order);
void *linuxkpi_page_frag_alloc(struct page_frag_cache *, size_t, gfp_t);
void linuxkpi_page_frag_free(void *);
void linuxkpi__page_frag_cache_drain(struct page *, size_t);
diff --git a/sys/compat/linuxkpi/common/include/linux/highmem.h b/sys/compat/linuxkpi/common/include/linux/highmem.h
index 1c2c97e03578..a3f9af82400e 100644
--- a/sys/compat/linuxkpi/common/include/linux/highmem.h
+++ b/sys/compat/linuxkpi/common/include/linux/highmem.h
@@ -47,7 +47,7 @@
#define PageHighMem(p) (0)
-static inline vm_page_t
+static inline struct page *
kmap_to_page(void *addr)
{
@@ -55,7 +55,7 @@ kmap_to_page(void *addr)
}
static inline void *
-kmap(vm_page_t page)
+kmap(struct page *page)
{
struct sf_buf *sf;
@@ -73,7 +73,7 @@ kmap(vm_page_t page)
}
static inline void *
-kmap_atomic_prot(vm_page_t page, pgprot_t prot)
+kmap_atomic_prot(struct page *page, pgprot_t prot)
{
vm_memattr_t attr = pgprot2cachemode(prot);
@@ -87,21 +87,21 @@ kmap_atomic_prot(vm_page_t page, pgprot_t prot)
}
static inline void *
-kmap_atomic(vm_page_t page)
+kmap_atomic(struct page *page)
{
return (kmap_atomic_prot(page, VM_PROT_ALL));
}
static inline void *
-kmap_local_page_prot(vm_page_t page, pgprot_t prot)
+kmap_local_page_prot(struct page *page, pgprot_t prot)
{
return (kmap_atomic_prot(page, prot));
}
static inline void
-kunmap(vm_page_t page)
+kunmap(struct page *page)
{
struct sf_buf *sf;
diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index ce3c94ee64aa..3d826f73a494 100644
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -246,19 +246,19 @@ vma_pages(struct vm_area_struct *vma)
#define offset_in_page(off) ((unsigned long)(off) & (PAGE_SIZE - 1))
static inline void
-set_page_dirty(struct vm_page *page)
+set_page_dirty(struct page *page)
{
vm_page_dirty(page);
}
static inline void
-mark_page_accessed(struct vm_page *page)
+mark_page_accessed(struct page *page)
{
vm_page_reference(page);
}
static inline void
-get_page(struct vm_page *page)
+get_page(struct page *page)
{
vm_page_wire(page);
}
@@ -305,7 +305,7 @@ pin_user_pages_remote(struct task_struct *task, struct mm_struct *mm,
}
static inline void
-put_page(struct vm_page *page)
+put_page(struct page *page)
{
vm_page_unwire(page, PQ_ACTIVE);
}
@@ -321,7 +321,7 @@ vm_get_page_prot(unsigned long vm_flags)
return (vm_flags & VM_PROT_ALL);
}
-static inline vm_page_t
+static inline struct page *
vmalloc_to_page(const void *addr)
{
vm_paddr_t paddr;
diff --git a/sys/compat/linuxkpi/common/include/linux/pagevec.h b/sys/compat/linuxkpi/common/include/linux/pagevec.h
index 4224124c4fe4..9ba8ff8effa0 100644
--- a/sys/compat/linuxkpi/common/include/linux/pagevec.h
+++ b/sys/compat/linuxkpi/common/include/linux/pagevec.h
@@ -13,7 +13,7 @@
struct pagevec {
uint8_t nr;
- struct vm_page *pages[PAGEVEC_SIZE];
+ struct page *pages[PAGEVEC_SIZE];
};
static inline unsigned int
@@ -41,7 +41,7 @@ pagevec_count(struct pagevec *pvec)
}
static inline unsigned int
-pagevec_add(struct pagevec *pvec, struct vm_page *page)
+pagevec_add(struct pagevec *pvec, struct page *page)
{
pvec->pages[pvec->nr++] = page;
return PAGEVEC_SIZE - pvec->nr;
diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index 41e4989c397c..ca2f6a8e6d08 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -96,10 +96,10 @@ linux_page_address(struct page *page)
IDX_TO_OFF(page->pindex)));
}
-vm_page_t
+struct page *
linux_alloc_pages(gfp_t flags, unsigned int order)
{
- vm_page_t page;
+ struct page *page;
if (PMAP_HAS_DMAP) {
unsigned long npages = 1UL << order;
@@ -146,7 +146,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order)
}
void
-linux_free_pages(vm_page_t page, unsigned int order)
+linux_free_pages(struct page *page, unsigned int order)
{
if (PMAP_HAS_DMAP) {
unsigned long npages = 1UL << order;
diff --git a/sys/compat/linuxkpi/common/src/linux_shmemfs.c b/sys/compat/linuxkpi/common/src/linux_shmemfs.c
index 0ebbd34d067d..3c71d6495f4a 100644
--- a/sys/compat/linuxkpi/common/src/linux_shmemfs.c
+++ b/sys/compat/linuxkpi/common/src/linux_shmemfs.c
@@ -45,7 +45,7 @@
struct page *
linux_shmem_read_mapping_page_gfp(vm_object_t obj, int pindex, gfp_t gfp)
{
- vm_page_t page;
+ struct page *page;
int rv;
if ((gfp & GFP_NOWAIT) != 0)