Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm uvm_mremap: reference the appropriate backing object.



details:   https://anonhg.NetBSD.org/src/rev/0e274d610a45
branches:  trunk
changeset: 957409:0e274d610a45
user:      yhardy <yhardy%NetBSD.org@localhost>
date:      Fri Nov 27 22:32:43 2020 +0000

description:
uvm_mremap: reference the appropriate backing object.

The previous approach was appropriate for anonymous
memory and device objects, which continue to work in
the same way.

OK: chs@
Fixes: PR 55237

diffstat:

 sys/uvm/uvm_mremap.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 32d34c133fa1 -r 0e274d610a45 sys/uvm/uvm_mremap.c
--- a/sys/uvm/uvm_mremap.c      Fri Nov 27 20:11:33 2020 +0000
+++ b/sys/uvm/uvm_mremap.c      Fri Nov 27 22:32:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_mremap.c,v 1.20 2020/02/23 15:46:43 ad Exp $       */
+/*     $NetBSD: uvm_mremap.c,v 1.21 2020/11/27 22:32:43 yhardy Exp $   */
 
 /*-
  * Copyright (c)2006,2007,2009 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mremap.c,v 1.20 2020/02/23 15:46:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mremap.c,v 1.21 2020/11/27 22:32:43 yhardy Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -80,10 +80,8 @@
                        error = E2BIG; /* XXX */
                        goto done;
                }
-               rw_enter(uobj->vmobjlock, RW_WRITER);
-               KASSERT(uobj->uo_refs > 0);
-               atomic_inc_uint(&uobj->uo_refs);
-               rw_exit(uobj->vmobjlock);
+               if (uobj->pgops->pgo_reference)
+                       uobj->pgops->pgo_reference(uobj);
                reserved_entry->object.uvm_obj = uobj;
                reserved_entry->offset = newoffset;
        }



Home | Main Index | Thread Index | Old Index