From 8e2dc22e79579ac9985807dda43625bba2ce570b Mon Sep 17 00:00:00 2001 From: skrll Date: Fri, 23 Dec 2016 09:36:55 +0000 Subject: [PATCH] Fix uvm_page_physget_freelist so that it actually performs the two passes it mentions. --- sys/uvm/uvm_page.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 964d79116c5e..0a8f0bee60b0 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.190 2016/12/23 07:15:28 cherry Exp $ */ +/* $NetBSD: uvm_page.c,v 1.191 2016/12/23 09:36:55 skrll Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.190 2016/12/23 07:15:28 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.191 2016/12/23 09:36:55 skrll Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -619,9 +619,9 @@ uvm_page_physget_freelist(paddr_t *paddrp, int freelist) /* pass 1: try allocating from a matching end */ #if (VM_PHYSSEG_STRAT == VM_PSTRAT_BIGFIRST) - for (lcv = uvm_physseg_get_last() ; uvm_physseg_valid_p(lcv) ; lcv = uvm_physseg_get_prev(lcv)) + for (lcv = uvm_physseg_get_last(); uvm_physseg_valid_p(lcv); lcv = uvm_physseg_get_prev(lcv)) #else - for (lcv = uvm_physseg_get_first() ; uvm_physseg_valid_p(lcv) ; lcv = uvm_physseg_get_next(lcv)) + for (lcv = uvm_physseg_get_first(); uvm_physseg_valid_p(lcv); lcv = uvm_physseg_get_next(lcv)) #endif { if (uvm.page_init_done == true) @@ -633,13 +633,13 @@ uvm_page_physget_freelist(paddr_t *paddrp, int freelist) continue; } else return true; - + } /* pass2: forget about matching ends, just allocate something */ #if (VM_PHYSSEG_STRAT == VM_PSTRAT_BIGFIRST) - for (lcv = uvm_physseg_get_last() ; uvm_physseg_valid_p(lcv); lcv = uvm_physseg_get_prev(lcv)) + for (lcv = uvm_physseg_get_last(); uvm_physseg_valid_p(lcv); lcv = uvm_physseg_get_prev(lcv)) #else - for (lcv = uvm_physseg_get_first() ; uvm_physseg_valid_p(lcv) ; lcv = uvm_physseg_get_next(lcv)) + for (lcv = uvm_physseg_get_first(); uvm_physseg_valid_p(lcv); lcv = uvm_physseg_get_next(lcv)) #endif { /* Try the front regardless. */ @@ -649,7 +649,6 @@ uvm_page_physget_freelist(paddr_t *paddrp, int freelist) } else return true; } - } return false; }