Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148096650
D49813.1785359776.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49813.1785359776.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D49813: linuxkpi: Make "free page" code paths closer to Linux
Attached
Detach File
Event Timeline
Log In to Comment