Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpkern rump - page/object dirtyness track...



details:   https://anonhg.NetBSD.org/src/rev/4f22f9a0d235
branches:  trunk
changeset: 745867:4f22f9a0d235
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Mar 14 19:54:06 2020 +0000

description:
rump - page/object dirtyness tracking corrections.

diffstat:

 sys/rump/librump/rumpkern/vm.c |  27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r a0a075ee527b -r 4f22f9a0d235 sys/rump/librump/rumpkern/vm.c
--- a/sys/rump/librump/rumpkern/vm.c    Sat Mar 14 19:29:39 2020 +0000
+++ b/sys/rump/librump/rumpkern/vm.c    Sat Mar 14 19:54:06 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm.c,v 1.184 2020/02/23 15:46:42 ad Exp $      */
+/*     $NetBSD: vm.c,v 1.185 2020/03/14 19:54:06 ad Exp $      */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.184 2020/02/23 15:46:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.185 2020/03/14 19:54:06 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -172,9 +172,11 @@
        pg->offset = off;
        pg->uobject = uobj;
 
-       pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
-       if (flags & UVM_PGA_ZERO) {
-               uvm_pagezero(pg);
+       if (UVM_OBJ_IS_VNODE(uobj) && uobj->uo_npages == 0) {
+               struct vnode *vp = (struct vnode *)uobj;
+               mutex_enter(vp->v_interlock);
+               vp->v_iflag |= VI_PAGES;
+               mutex_exit(vp->v_interlock);
        }
 
        if (radix_tree_insert_node(&uobj->uo_pages, off >> PAGE_SHIFT,
@@ -182,6 +184,12 @@
                pool_cache_put(&pagecache, pg);
                return NULL;
        }
+       uobj->uo_npages++;
+
+       pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
+       if (flags & UVM_PGA_ZERO) {
+               uvm_pagezero(pg);
+       }
 
        /*
         * Don't put anons on the LRU page queue.  We can't flush them
@@ -195,8 +203,6 @@
                mutex_exit(&vmpage_lruqueue_lock);
        }
 
-       uobj->uo_npages++;
-
        return pg;
 }
 
@@ -227,6 +233,13 @@
                atomic_dec_uint(&vmpage_onqueue);
        }
 
+       if (UVM_OBJ_IS_VNODE(uobj) && uobj->uo_npages == 0) {
+               struct vnode *vp = (struct vnode *)uobj;
+               mutex_enter(vp->v_interlock);
+               vp->v_iflag &= ~VI_PAGES;
+               mutex_exit(vp->v_interlock);
+       }
+
        mutex_destroy(&pg->interlock);
        pool_cache_put(&pagecache, pg);
 }



Home | Main Index | Thread Index | Old Index