Page MenuHomeFreeBSD

vm_page: drop prev and next
ClosedPublic

Authored by dougm on Apr 18 2025, 5:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 15, 5:36 PM
Unknown Object (File)
Mon, Dec 15, 5:36 PM
Unknown Object (File)
Thu, Dec 11, 12:12 AM
Unknown Object (File)
Nov 22 2025, 6:22 PM
Unknown Object (File)
Nov 5 2025, 7:26 AM
Unknown Object (File)
Nov 5 2025, 4:41 AM
Unknown Object (File)
Nov 5 2025, 3:18 AM
Unknown Object (File)
Nov 4 2025, 7:06 PM

Details

Summary

Functions vm_page_prev() and vm_page_next() are no longer invoked. Remove them.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.Apr 18 2025, 5:35 PM
dougm created this revision.
This revision is now accepted and ready to land.Apr 18 2025, 6:10 PM
This revision was automatically updated to reflect the committed changes.

I've attached a patch to the drm-kmod sources that I expect to address the problem. A similar patch may well address the other cases.

This change is part of an effort to eliminate from the implementation the doubly-linked list that vm_page_next() depends on.

{F114969018}

I've attached a patch to the drm-kmod sources that I expect to address the problem. A similar patch may well address the other cases.

This change is part of an effort to eliminate from the implementation the doubly-linked list that vm_page_next() depends on.

{F114969018}

Can't access {F114969018} patch. From the F11* patches listed in review, F114969018 doesn't show up and I see too that one is restricted.

Don't know how to remove restriction. Here's the patch:

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index 2a9946c7d0..9c0275af71 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -34,6 +34,7 @@
 #include <vm/vm_object.h>
 #include <vm/vm_pager.h>
 #include <vm/vm_param.h>
+#include <vm/vm_radix.h>
 #endif
 
 #ifdef __linux__ /* Mute unused function warning. */
@@ -73,6 +74,8 @@ int
 i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
                    struct drm_file *file)
 {
+       struct pctrie_iter pages;
+       vm_page_t page;
        struct drm_i915_private *i915 = to_i915(dev);
        struct drm_i915_gem_mmap *args = data;
        struct drm_i915_gem_object *obj;
@@ -166,9 +169,10 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
 
        /* currently disabled as it causes artifacts on FreeBSD */
        if ((rv == KERN_SUCCESS) && (args->flags & I915_MMAP_WC)) {
+               vm_page_iter_init(&pages, vmobj);
                VM_OBJECT_WLOCK(vmobj);
                if (vm_object_set_memattr(vmobj, VM_MEMATTR_WRITE_COMBINING) != KERN_SUCCESS) {
-                       for (vm_page_t page = vm_page_find_least(vmobj, 0); page != NULL; page = vm_page_next(page)) {
+                       VM_RADIX_FORALL(page, &pages) {
                                pmap_page_set_memattr(page, VM_MEMATTR_WRITE_COMBINING);
                        }
                }

@dougm

Using your patch at graphics/drm-61-kmod port and it builded fine and run is ok too.
Also, there is a pull at https://github.com/freebsd/drm-kmod/pull/348

Thanks!