Module Name:    src
Committed By:   ad
Date:           Sun May 17 17:12:28 UTC 2020

Modified Files:
        src/sys/uvm: uvm_page.c

Log Message:
Don't set PG_AOBJ on a page unless UVM_OBJ_IS_AOBJ(), otherwise it can
catch pages from e.g. uvm_loanzero_object.


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 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.235 src/sys/uvm/uvm_page.c:1.236
--- src/sys/uvm/uvm_page.c:1.235	Sun May 17 15:11:57 2020
+++ src/sys/uvm/uvm_page.c	Sun May 17 17:12:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.235 2020/05/17 15:11:57 ad Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.236 2020/05/17 17:12:28 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.235 2020/05/17 15:11:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.236 2020/05/17 17:12:28 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -220,10 +220,8 @@ uvm_pageinsert_object(struct uvm_object 
 	if ((pg->flags & PG_STAT) != 0) {
 		/* Cannot use uvm_pagegetdirty(): not yet in radix tree. */
 		const unsigned int status = pg->flags & (PG_CLEAN | PG_DIRTY);
-		const bool isaobj = (pg->flags & PG_AOBJ) != 0;
 
-		if (!isaobj) {
-			KASSERT((pg->flags & PG_FILE) != 0);
+		if ((pg->flags & PG_FILE) != 0) {
 			if (uobj->uo_npages == 0) {
 				struct vnode *vp = (struct vnode *)uobj;
 				mutex_enter(vp->v_interlock);
@@ -285,10 +283,8 @@ uvm_pageremove_object(struct uvm_object 
 	if ((pg->flags & PG_STAT) != 0) {
 		/* Cannot use uvm_pagegetdirty(): no longer in radix tree. */
 		const unsigned int status = pg->flags & (PG_CLEAN | PG_DIRTY);
-		const bool isaobj = (pg->flags & PG_AOBJ) != 0;
 
-		if (!isaobj) {
-			KASSERT((pg->flags & PG_FILE) != 0);
+		if ((pg->flags & PG_FILE) != 0) {
 			if (uobj->uo_npages == 1) {
 				struct vnode *vp = (struct vnode *)uobj;
 				mutex_enter(vp->v_interlock);
@@ -1336,7 +1332,7 @@ uvm_pagealloc_strat(struct uvm_object *o
 		 */
 		if (UVM_OBJ_IS_VNODE(obj)) {
 			pg->flags |= PG_FILE;
-		} else {
+		} else if (UVM_OBJ_IS_AOBJ(obj)) {
 			pg->flags |= PG_AOBJ;
 		}
 		uvm_pageinsert_object(obj, pg);

Reply via email to