Module Name: src Committed By: ad Date: Fri May 15 22:27:04 UTC 2020
Modified Files: src/sys/uvm: uvm_aobj.c Log Message: PR kern/55268: tmpfs is slow uao_get(): in the PGO_LOCKED case, we're okay to allocate a new page as long as the caller holds a write lock. PGO_NOBUSY doesn't put a stop to that. To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/sys/uvm/uvm_aobj.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_aobj.c diff -u src/sys/uvm/uvm_aobj.c:1.139 src/sys/uvm/uvm_aobj.c:1.140 --- src/sys/uvm/uvm_aobj.c:1.139 Sun Mar 22 18:32:42 2020 +++ src/sys/uvm/uvm_aobj.c Fri May 15 22:27:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_aobj.c,v 1.139 2020/03/22 18:32:42 ad Exp $ */ +/* $NetBSD: uvm_aobj.c,v 1.140 2020/05/15 22:27:04 ad Exp $ */ /* * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.139 2020/03/22 18:32:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.140 2020/05/15 22:27:04 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_uvmhist.h" @@ -827,6 +827,7 @@ uao_get(struct uvm_object *uobj, voff_t */ if (flags & PGO_LOCKED) { + krw_t lktype = rw_lock_op(uobj->vmobjlock); /* * step 1a: get pages that are already resident. only do @@ -845,11 +846,11 @@ uao_get(struct uvm_object *uobj, voff_t /* * if page is new, attempt to allocate the page, - * zero-fill'd. we can only do this if busying - * pages, as otherwise the object is read locked. + * zero-fill'd. we can only do this if the caller + * holds a write lock. */ - if ((flags & PGO_NOBUSY) == 0 && ptmp == NULL && + if (ptmp == NULL && lktype == RW_WRITER && uao_find_swslot(uobj, current_offset >> PAGE_SHIFT) == 0) { ptmp = uao_pagealloc(uobj, current_offset, @@ -859,6 +860,8 @@ uao_get(struct uvm_object *uobj, voff_t ptmp->flags &= ~(PG_FAKE); uvm_pagemarkdirty(ptmp, UVM_PAGE_STATUS_UNKNOWN); + if ((flags & PGO_NOBUSY) != 0) + ptmp->flags &= ~PG_BUSY; goto gotpage; } }