Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2021 13:32:29 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6a9e83fec125 - stable/13 - vm_page_startup: correct calculation of the starting page
Message-ID:  <202109211332.18LDWTUG021881@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a9e83fec1256fe3378d78ccf1964bc087111101

commit 6a9e83fec1256fe3378d78ccf1964bc087111101
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-09-17 18:48:42 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-09-21 13:31:27 +0000

    vm_page_startup: correct calculation of the starting page
    
    (cherry picked from commit bd3a668087efb02e8e84315f7cc29d3813270dff)
---
 sys/vm/vm_page.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index dc56ca9bae05..9ca18129f415 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -775,27 +775,25 @@ vm_page_startup(vm_offset_t vaddr)
 		 * phys_avail's ranges to the free lists.
 		 */
 		for (i = 0; phys_avail[i + 1] != 0; i += 2) {
-			if (seg->end < phys_avail[i] ||
+			if (seg->end <= phys_avail[i] ||
 			    seg->start >= phys_avail[i + 1])
 				continue;
 
 			startp = MAX(seg->start, phys_avail[i]);
-			m = seg->first_page + atop(seg->start - startp);
 			endp = MIN(seg->end, phys_avail[i + 1]);
 			pagecount = (u_long)atop(endp - startp);
 			if (pagecount == 0)
 				continue;
 
+			m = seg->first_page + atop(startp - seg->start);
 			vmd = VM_DOMAIN(seg->domain);
 			vm_domain_free_lock(vmd);
 			vm_phys_enqueue_contig(m, pagecount);
 			vm_domain_free_unlock(vmd);
 			vm_domain_freecnt_inc(vmd, pagecount);
 			vm_cnt.v_page_count += (u_int)pagecount;
-
-			vmd = VM_DOMAIN(seg->domain);
 			vmd->vmd_page_count += (u_int)pagecount;
-			vmd->vmd_segs |= 1UL << m->segind;
+			vmd->vmd_segs |= 1UL << segind;
 		}
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109211332.18LDWTUG021881>