Module Name: src Committed By: ad Date: Mon Dec 30 17:45:53 UTC 2019
Modified Files: src/sys/uvm: uvm_page.c Log Message: uvm_pagealloc_pgb(): don't fill cache if we're into the reserves. uvm_pagereplace(): use radix_tree_replace_node() to avoid alloc/free. To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/sys/uvm/uvm_page.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_page.c diff -u src/sys/uvm/uvm_page.c:1.216 src/sys/uvm/uvm_page.c:1.217 --- src/sys/uvm/uvm_page.c:1.216 Sat Dec 28 16:07:41 2019 +++ src/sys/uvm/uvm_page.c Mon Dec 30 17:45:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.216 2019/12/28 16:07:41 ad Exp $ */ +/* $NetBSD: uvm_page.c,v 1.217 2019/12/30 17:45:53 ad Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.216 2019/12/28 16:07:41 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.217 2019/12/30 17:45:53 ad Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -1028,6 +1028,7 @@ uvm_pagealloc_pgb(struct uvm_cpu *ucpu, struct pgflbucket *pgb; struct vm_page *pg; kmutex_t *lock; + bool fill; /* * Skip the bucket if empty, no lock needed. There could be many @@ -1048,6 +1049,9 @@ uvm_pagealloc_pgb(struct uvm_cpu *ucpu, mutex_spin_exit(lock); return NULL; } + fill = false; + } else { + fill = true; } /* Try all page colors as needed. */ @@ -1073,7 +1077,7 @@ uvm_pagealloc_pgb(struct uvm_cpu *ucpu, * so if we found pages in this CPU's preferred * bucket. */ - if (__predict_true(b == ucpu->pgflbucket)) { + if (__predict_true(b == ucpu->pgflbucket && fill)) { uvm_pgflcache_fill(ucpu, f, b, c); } mutex_spin_exit(lock); @@ -1347,6 +1351,7 @@ void uvm_pagereplace(struct vm_page *oldpg, struct vm_page *newpg) { struct uvm_object *uobj = oldpg->uobject; + struct vm_page *pg __diagused; KASSERT((oldpg->flags & PG_TABLED) != 0); KASSERT(uobj != NULL); @@ -1355,8 +1360,9 @@ uvm_pagereplace(struct vm_page *oldpg, s KASSERT(mutex_owned(uobj->vmobjlock)); newpg->offset = oldpg->offset; - uvm_pageremove_tree(uobj, oldpg); - uvm_pageinsert_tree(uobj, newpg); + pg = radix_tree_replace_node(&uobj->uo_pages, + newpg->offset >> PAGE_SHIFT, newpg); + KASSERT(pg == oldpg); /* take page interlocks during rename */ if (oldpg < newpg) {