Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Adjust pdpending in uvm_pageout_start() and uvm_page...



details:   https://anonhg.NetBSD.org/src/rev/0363012a715e
branches:  trunk
changeset: 967552:0363012a715e
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Dec 14 15:04:47 2019 +0000

description:
Adjust pdpending in uvm_pageout_start() and uvm_pageout_done() to avoid
the value going temporarily negative.

diffstat:

 sys/uvm/uvm_pager.c   |   5 ++---
 sys/uvm/uvm_pdaemon.c |  12 ++++++------
 2 files changed, 8 insertions(+), 9 deletions(-)

diffs (77 lines):

diff -r fdf76f579481 -r 0363012a715e sys/uvm/uvm_pager.c
--- a/sys/uvm/uvm_pager.c       Sat Dec 14 14:46:11 2019 +0000
+++ b/sys/uvm/uvm_pager.c       Sat Dec 14 15:04:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pager.c,v 1.114 2019/12/13 20:10:22 ad Exp $       */
+/*     $NetBSD: uvm_pager.c,v 1.115 2019/12/14 15:04:47 ad Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.114 2019/12/13 20:10:22 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.115 2019/12/14 15:04:47 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -473,7 +473,6 @@
                        else
                                uvm_swap_free(swslot, npages);
                }
-               atomic_dec_uint(&uvmexp.pdpending);
 #endif /* defined(VMSWAP) */
        }
 }
diff -r fdf76f579481 -r 0363012a715e sys/uvm/uvm_pdaemon.c
--- a/sys/uvm/uvm_pdaemon.c     Sat Dec 14 14:46:11 2019 +0000
+++ b/sys/uvm/uvm_pdaemon.c     Sat Dec 14 15:04:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdaemon.c,v 1.113 2019/12/13 20:10:22 ad Exp $     */
+/*     $NetBSD: uvm_pdaemon.c,v 1.114 2019/12/14 15:04:47 ad Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.113 2019/12/13 20:10:22 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.114 2019/12/14 15:04:47 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -368,6 +368,7 @@
 uvm_pageout_start(int npages)
 {
 
+       atomic_inc_uint(&uvmexp.pdpending);
        atomic_add_int(&uvmexp.paging, npages);
 }
 
@@ -376,6 +377,7 @@
 {
 
        KASSERT(uvmexp.paging >= npages);
+       atomic_dec_uint(&uvmexp.pdpending);
        atomic_add_int(&uvmexp.paging, -npages);
 
        /*
@@ -899,14 +901,12 @@
                }
                mutex_exit(slock);
 
-               swapcluster_flush(&swc, false);
-
                /*
-                * the pageout is in progress.  bump counters and set up
+                * set the pageout in progress.  bump counters and set up
                 * for the next loop.
                 */
 
-               atomic_inc_uint(&uvmexp.pdpending);
+               swapcluster_flush(&swc, false);
 
 #else /* defined(VMSWAP) */
                uvm_pageactivate(p);



Home | Main Index | Thread Index | Old Index