Page MenuHomeFreeBSD

D49813.1785359776.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D49813.1785359776.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -278,7 +278,8 @@
static inline void
put_page(struct page *page)
{
- vm_page_unwire(page, PQ_ACTIVE);
+ /* `__free_page()` takes care of the refcounting (unwire). */
+ __free_page(page);
}
void linux_release_pages(struct page **pages, int nr);
diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -165,8 +165,24 @@
for (x = 0; x != npages; x++) {
vm_page_t pgo = page + x;
- if (vm_page_unwire_noq(pgo))
- vm_page_free(pgo);
+ /*
+ * The "free page" function is used in several
+ * contexts.
+ *
+ * Some pages are allocated by `linux_alloc_pages()`
+ * above, but not all of them are. For instance in the
+ * DRM drivers, some pages come from
+ * `shmem_read_mapping_page_gfp()`.
+ *
+ * That's why we need to check if the page is managed
+ * or not here.
+ */
+ if ((pgo->oflags & VPO_UNMANAGED) == 0) {
+ vm_page_unwire(pgo, PQ_ACTIVE);
+ } else {
+ if (vm_page_unwire_noq(pgo))
+ vm_page_free(pgo);
+ }
}
} else {
vm_offset_t vaddr;
@@ -183,7 +199,7 @@
int i;
for (i = 0; i < nr; i++)
- put_page(pages[i]);
+ __free_page(pages[i]);
}
vm_offset_t

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 29, 9:16 PM (3 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29307102
Default Alt Text
D49813.1785359776.diff (1 KB)

Event Timeline