Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm for direct map case, avoid PGO_NOBLOCKALLOC when wri...



details:   https://anonhg.NetBSD.org/src/rev/844961c1d904
branches:  trunk
changeset: 995154:844961c1d904
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Dec 09 20:45:37 2018 +0000

description:
for direct map case, avoid PGO_NOBLOCKALLOC when writing, it makes
genfs_getpages() return unallocated pages using the zero page and
PG_RDONLY; the old code relied on fault logic to get it allocated, which
the direct case can't rely on

instead just allocate the blocks right away; pass PGO_JOURNALLOCKED
so that code wouldn't try to take wapbl lock, this code path is called
with it already held

this should fix KASSERT() due to PG_RDONLY on write with wapbl

towards resolution of PR kern/53124

diffstat:

 sys/uvm/uvm_bio.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 57799fa4bddd -r 844961c1d904 sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Sun Dec 09 20:33:04 2018 +0000
+++ b/sys/uvm/uvm_bio.c Sun Dec 09 20:45:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_bio.c,v 1.98 2018/11/20 20:07:19 jdolecek Exp $    */
+/*     $NetBSD: uvm_bio.c,v 1.99 2018/12/09 20:45:37 jdolecek Exp $    */
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.98 2018/11/20 20:07:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.99 2018/12/09 20:45:37 jdolecek Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -814,8 +814,7 @@
 {
        voff_t pgoff;
        int error;
-       int gpflags = flags | PGO_NOTIMESTAMP | PGO_SYNCIO | PGO_ALLPAGES
-           | PGO_NOBLOCKALLOC;
+       int gpflags = flags | PGO_NOTIMESTAMP | PGO_SYNCIO | PGO_ALLPAGES;
        int access_type = VM_PROT_READ;
        UVMHIST_FUNC("ubc_alloc_direct"); UVMHIST_CALLED(ubchist);
 
@@ -826,8 +825,15 @@
                KASSERT(!UVM_OBJ_NEEDS_WRITEFAULT(uobj));
 #endif
 
-               gpflags |= PGO_PASTEOF;
+               /*
+                * Tell genfs_getpages() we already have the journal lock,
+                * allow allocation past current EOF.
+                */
+               gpflags |= PGO_JOURNALLOCKED | PGO_PASTEOF;
                access_type |= VM_PROT_WRITE;
+       } else {
+               /* Don't need the empty blocks allocated, PG_RDONLY is okay */
+               gpflags |= PGO_NOBLOCKALLOC;
        }
 
        pgoff = (offset & PAGE_MASK);



Home | Main Index | Thread Index | Old Index