Date: Sun, 19 Sep 2021 18:31:41 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bd3a668087ef - main - vm_page_startup: correct calculation of the starting page Message-ID: <202109191831.18JIVfIW053294@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd3a668087efb02e8e84315f7cc29d3813270dff commit bd3a668087efb02e8e84315f7cc29d3813270dff Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-09-17 18:48:42 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-09-19 18:27:55 +0000 vm_page_startup: correct calculation of the starting page Also avoid unneded calculations when phys segment end is the phys_avail[] start. Submitted by: alc Reviewed by: markj MFC after: 1 week Fixes: 181bfb42fd01bfa9f46 Differential revision: https://reviews.freebsd.org/D32009 --- 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 d2e94ced6766..25e6dce32aa6 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?202109191831.18JIVfIW053294>