Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm uvm_pagerealloc(): resurrect the insertion case.
details: https://anonhg.NetBSD.org/src/rev/794c14f76a3a
branches: trunk
changeset: 972924:794c14f76a3a
user: ad <ad%NetBSD.org@localhost>
date: Sat Jun 13 19:55:39 2020 +0000
description:
uvm_pagerealloc(): resurrect the insertion case.
diffstat:
sys/uvm/uvm_extern.h | 4 ++--
sys/uvm/uvm_page.c | 31 +++++++++++++++++++++++--------
2 files changed, 25 insertions(+), 10 deletions(-)
diffs (82 lines):
diff -r e4a470e2fd86 -r 794c14f76a3a sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Sat Jun 13 19:47:10 2020 +0000
+++ b/sys/uvm/uvm_extern.h Sat Jun 13 19:55:39 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.228 2020/06/11 19:20:47 ad Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.229 2020/06/13 19:55:58 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -789,7 +789,7 @@
UVM_PGA_STRAT_NORMAL, 0)
void uvm_pagereplace(struct vm_page *,
struct vm_page *);
-void uvm_pagerealloc(struct vm_page *,
+int uvm_pagerealloc(struct vm_page *,
struct uvm_object *, voff_t);
void uvm_setpagesize(void);
diff -r e4a470e2fd86 -r 794c14f76a3a sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Sat Jun 13 19:47:10 2020 +0000
+++ b/sys/uvm/uvm_page.c Sat Jun 13 19:55:39 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.240 2020/06/11 22:21:05 ad Exp $ */
+/* $NetBSD: uvm_page.c,v 1.241 2020/06/13 19:55:39 ad Exp $ */
/*-
* Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.240 2020/06/11 22:21:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.241 2020/06/13 19:55:39 ad Exp $");
#include "opt_ddb.h"
#include "opt_uvm.h"
@@ -1411,12 +1411,13 @@
* uvm_pagerealloc: reallocate a page from one object to another
*
* => both objects must be locked
- * => both interlocks must be held
*/
-void
+int
uvm_pagerealloc(struct vm_page *pg, struct uvm_object *newobj, voff_t newoff)
{
+ int error = 0;
+
/*
* remove it from the old object
*/
@@ -1431,11 +1432,25 @@
*/
if (newobj) {
- /*
- * XXX we have no in-tree users of this functionality
- */
- panic("uvm_pagerealloc: no impl");
+ mutex_enter(&pg->interlock);
+ pg->uobject = newobj;
+ pg->offset = newoff;
+ if (UVM_OBJ_IS_VNODE(newobj)) {
+ pg->flags |= PG_FILE;
+ } else if (UVM_OBJ_IS_AOBJ(newobj)) {
+ pg->flags |= PG_AOBJ;
+ }
+ uvm_pageinsert_object(newobj, pg);
+ mutex_exit(&pg->interlock);
+ error = uvm_pageinsert_tree(newobj, pg);
+ if (error != 0) {
+ mutex_enter(&pg->interlock);
+ uvm_pageremove_object(newobj, pg);
+ mutex_exit(&pg->interlock);
+ }
}
+
+ return error;
}
#ifdef DEBUG
Home |
Main Index |
Thread Index |
Old Index