git: ae4c7e6aa036 - main - riscv: fix pv_chunk check in pmap_pv_demote_l2()

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Tue, 09 Jul 2024 18:48:22 UTC
The branch main has been updated by mhorne:

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

commit ae4c7e6aa0361f67abeeadb7b60ee22815895be7
Author:     Wuyang Chung <wy-chung@outlook.com>
AuthorDate: 2024-07-07 15:07:42 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-07-09 18:46:16 +0000

    riscv: fix pv_chunk check in pmap_pv_demote_l2()
    
    It is the full chunk that should be placed at the tail of the list, not
    the free chunk.
    
    Reviewed by:    mhorne, jhb
    MFC after:      1 week3 days
    Fixes:  4d90a5afc51b ("sys: Consolidate common implementation details...")
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1321
---
 sys/riscv/riscv/pmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index 8fb017f66951..bcf2ada887fb 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -2242,7 +2242,7 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
 		TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list);
 	}
 out:
-	if (pc_is_free(pc)) {
+	if (pc_is_full(pc)) {
 		TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
 		TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list);
 	}