The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6b38974085215bcd787be0d138411ec57cf0096e

commit 6b38974085215bcd787be0d138411ec57cf0096e
Author:     Mark Johnston <[email protected]>
AuthorDate: 2022-07-12 12:51:02 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2022-07-12 13:10:15 +0000

    vm_object: Modify various drivers to allocate OBJT_SWAP objects
    
    This is in preparation for removal of OBJT_DEFAULT.  In particular, it
    is now cheap to check whether an OBJT_SWAP object has any swap blocks
    allocated, so the benefit of having a separate OBJT_DEFAULT type is
    quite marginal, and the OBJT_DEFAULT->SWAP transition is a source of
    bugs.
    
    Reviewed by:    alc, hselasky, kib
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35779
---
 sys/amd64/vmm/vmm.c                            | 2 +-
 sys/compat/linuxkpi/common/src/linux_shmemfs.c | 2 +-
 sys/dev/agp/agp.c                              | 2 +-
 sys/dev/agp/agp_i810.c                         | 2 +-
 sys/dev/drm2/drm_gem.c                         | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
index 47299301f5f0..94f99fdb4f1a 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -697,7 +697,7 @@ vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool 
sysmem)
                        return (EINVAL);
        }
 
-       obj = vm_object_allocate(OBJT_DEFAULT, len >> PAGE_SHIFT);
+       obj = vm_object_allocate(OBJT_SWAP, len >> PAGE_SHIFT);
        if (obj == NULL)
                return (ENOMEM);
 
diff --git a/sys/compat/linuxkpi/common/src/linux_shmemfs.c 
b/sys/compat/linuxkpi/common/src/linux_shmemfs.c
index ead9cc9d9f40..741bb20c1aab 100644
--- a/sys/compat/linuxkpi/common/src/linux_shmemfs.c
+++ b/sys/compat/linuxkpi/common/src/linux_shmemfs.c
@@ -84,7 +84,7 @@ linux_shmem_file_setup(const char *name, loff_t size, 
unsigned long flags)
 
        filp->f_count = 1;
        filp->f_vnode = vp;
-       filp->f_shmem = vm_pager_allocate(OBJT_DEFAULT, NULL, size,
+       filp->f_shmem = vm_pager_allocate(OBJT_SWAP, NULL, size,
            VM_PROT_READ | VM_PROT_WRITE, 0, curthread->td_ucred);
        if (filp->f_shmem == NULL) {
                error = -ENOMEM;
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
index 39e9d5dd64e7..d61ae11f998f 100644
--- a/sys/dev/agp/agp.c
+++ b/sys/dev/agp/agp.c
@@ -514,7 +514,7 @@ agp_generic_alloc_memory(device_t dev, int type, vm_size_t 
size)
        mem->am_id = sc->as_nextid++;
        mem->am_size = size;
        mem->am_type = 0;
-       mem->am_obj = vm_object_allocate(OBJT_DEFAULT, atop(round_page(size)));
+       mem->am_obj = vm_object_allocate(OBJT_SWAP, atop(round_page(size)));
        mem->am_physical = 0;
        mem->am_offset = 0;
        mem->am_is_bound = 0;
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index 433d7d3f50c7..400e70a402c1 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -1744,7 +1744,7 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t 
size)
        mem->am_size = size;
        mem->am_type = type;
        if (type != 1 && (type != 2 || size == AGP_PAGE_SIZE))
-               mem->am_obj = vm_object_allocate(OBJT_DEFAULT,
+               mem->am_obj = vm_object_allocate(OBJT_SWAP,
                    atop(round_page(size)));
        else
                mem->am_obj = 0;
diff --git a/sys/dev/drm2/drm_gem.c b/sys/dev/drm2/drm_gem.c
index 2692eb2499ae..7cfe09e46c01 100644
--- a/sys/dev/drm2/drm_gem.c
+++ b/sys/dev/drm2/drm_gem.c
@@ -111,7 +111,7 @@ int drm_gem_object_init(struct drm_device *dev,
            ("Bad size %ju", (uintmax_t)size));
 
        obj->dev = dev;
-       obj->vm_obj = vm_pager_allocate(OBJT_DEFAULT, NULL, size,
+       obj->vm_obj = vm_pager_allocate(OBJT_SWAP, NULL, size,
            VM_PROT_READ | VM_PROT_WRITE, 0, curthread->td_ucred);
 
        obj->refcount = 1;

Reply via email to