Module Name: src Committed By: skrll Date: Mon Dec 20 22:40:47 UTC 2021
Modified Files: src/sys/uvm: uvm_pglist.c Log Message: Slight code re-structure and wrap a long line. Interestingly this gives the same binary before and after. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/uvm/uvm_pglist.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_pglist.c diff -u src/sys/uvm/uvm_pglist.c:1.88 src/sys/uvm/uvm_pglist.c:1.89 --- src/sys/uvm/uvm_pglist.c:1.88 Fri Mar 26 09:35:18 2021 +++ src/sys/uvm/uvm_pglist.c Mon Dec 20 22:40:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pglist.c,v 1.88 2021/03/26 09:35:18 chs Exp $ */ +/* $NetBSD: uvm_pglist.c,v 1.89 2021/12/20 22:40:46 skrll Exp $ */ /*- * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.88 2021/03/26 09:35:18 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.89 2021/12/20 22:40:46 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -125,18 +125,19 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, low = atop(low); high = atop(high); - alignment = atop(alignment); /* * Make sure that physseg falls within with range to be allocated from. */ - if (high <= uvm_physseg_get_avail_start(psi) || low >= uvm_physseg_get_avail_end(psi)) + if (high <= uvm_physseg_get_avail_start(psi) || + low >= uvm_physseg_get_avail_end(psi)) return 0; /* * We start our search at the just after where the last allocation * succeeded. */ + alignment = atop(alignment); candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi) + uvm_physseg_get_start_hint(psi)), alignment); limit = uimin(high, uvm_physseg_get_avail_end(psi)); @@ -527,12 +528,6 @@ uvm_pglistalloc_s_ps(uvm_physseg_t psi, low = atop(low); high = atop(high); - todo = num; - candidate = uimax(low, uvm_physseg_get_avail_start(psi) + - uvm_physseg_get_start_hint(psi)); - limit = uimin(high, uvm_physseg_get_avail_end(psi)); - pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi)); - second_pass = false; /* * Make sure that physseg falls within with range to be allocated from. @@ -541,6 +536,13 @@ uvm_pglistalloc_s_ps(uvm_physseg_t psi, low >= uvm_physseg_get_avail_end(psi)) return 0; + todo = num; + candidate = uimax(low, uvm_physseg_get_avail_start(psi) + + uvm_physseg_get_start_hint(psi)); + limit = uimin(high, uvm_physseg_get_avail_end(psi)); + pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi)); + second_pass = false; + again: for (;; candidate++, pg++) { if (candidate >= limit) {