git: 2735c20d114f - main - vm_page: use ref_count for NOFREE counter
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 May 2025 02:17:47 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=2735c20d114f2d53b8a44d4fb7b00ab49280062b commit 2735c20d114f2d53b8a44d4fb7b00ab49280062b Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2025-05-02 02:16:27 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2025-05-02 02:16:27 +0000 vm_page: use ref_count for NOFREE counter In managing freed PG_NOFREE pages, use ref_count instead of pindex for counting pages in freed PG_NOFREE blocks. No change in behavior is expected. This restores the (useful) property that the pindex field is of interest only for pages that are mapped to objects. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D50112 --- sys/vm/vm_page.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 8dce6feaca09..d254f08d4801 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2593,18 +2593,19 @@ vm_page_alloc_nofree_domain(int domain, int req) vm_domain_free_unlock(vmd); return (NULL); } - m->pindex = count; + m->ref_count = count - 1; TAILQ_INSERT_HEAD(&vmd->vmd_nofreeq, m, listq); VM_CNT_ADD(v_nofree_count, count); } m = TAILQ_FIRST(&vmd->vmd_nofreeq); TAILQ_REMOVE(&vmd->vmd_nofreeq, m, listq); - if (m->pindex > 1) { + if (m->ref_count > 0) { vm_page_t m_next; m_next = &m[1]; - m_next->pindex = m->pindex - 1; + m_next->ref_count = m->ref_count - 1; TAILQ_INSERT_HEAD(&vmd->vmd_nofreeq, m_next, listq); + m->ref_count = 0; } vm_domain_free_unlock(vmd); VM_CNT_ADD(v_nofree_count, -1); @@ -2622,7 +2623,7 @@ static void __noinline vm_page_free_nofree(struct vm_domain *vmd, vm_page_t m) { vm_domain_free_lock(vmd); - m->pindex = 1; + MPASS(m->ref_count == 0); TAILQ_INSERT_HEAD(&vmd->vmd_nofreeq, m, listq); vm_domain_free_unlock(vmd); VM_CNT_ADD(v_nofree_count, 1);