Module Name:    src
Committed By:   rin
Date:           Thu Mar  5 12:21:00 UTC 2020

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

Log Message:
Part of PR kern/54994:

Memory allocated in the fast path of uarea_poolpage_alloc() is
a page itself. Therefore, it is obviously page-aligned.

Pointed out by skrll.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_glue.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_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.176 src/sys/uvm/uvm_glue.c:1.177
--- src/sys/uvm/uvm_glue.c:1.176	Sun Jan 12 12:55:03 2020
+++ src/sys/uvm/uvm_glue.c	Thu Mar  5 12:21:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.176 2020/01/12 12:55:03 ad Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.177 2020/03/05 12:21:00 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.176 2020/01/12 12:55:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.177 2020/03/05 12:21:00 rin Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -244,7 +244,8 @@ uarea_poolpage_alloc(struct pool *pp, in
 	KASSERT((flags & PR_WAITOK) != 0);
 
 #if defined(PMAP_MAP_POOLPAGE)
-	while (USPACE == PAGE_SIZE && USPACE_ALIGN == 0) {
+	while (USPACE == PAGE_SIZE &&
+	    (USPACE_ALIGN == 0 || USPACE_ALIGN == PAGE_SIZE)) {
 		struct vm_page *pg;
 		vaddr_t va;
 #if defined(PMAP_ALLOC_POOLPAGE)
@@ -274,7 +275,8 @@ static void
 uarea_poolpage_free(struct pool *pp, void *addr)
 {
 #if defined(PMAP_MAP_POOLPAGE)
-	if (USPACE == PAGE_SIZE && USPACE_ALIGN == 0) {
+	if (USPACE == PAGE_SIZE &&
+	    (USPACE_ALIGN == 0 || USPACE_ALIGN == PAGE_SIZE)) {
 		paddr_t pa;
 
 		pa = PMAP_UNMAP_POOLPAGE((vaddr_t) addr);

Reply via email to