git: e413e15c1ad5 - main - swap_pager_freespace: fix freed count
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Aug 2024 08:44:11 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=e413e15c1ad5ba6dde8d2747c3c505cc39746c80 commit e413e15c1ad5ba6dde8d2747c3c505cc39746c80 Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2024-08-07 08:37:18 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2024-08-07 08:37:18 +0000 swap_pager_freespace: fix freed count Function swp_pager_meta_transfer uses 'pindex' as the start address of the swblk in calculating which page to lookup in order to count freed pages. However, the lookup for a swblk at 'pindex' or greater may produce one greater than 'pindex', given by sb->p, and that's the value that should be used to compute a page adddress. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46234 --- sys/vm/swap_pager.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 9df1521858c1..59d947c71279 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2201,10 +2201,9 @@ swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject, VM_OBJECT_WLOCK(srcobject); } if (moved != NULL) { - if (m != NULL && m->pindex != pindex + i - 1) - m = NULL; - m = m != NULL ? vm_page_next(m) : - vm_page_lookup(srcobject, pindex + i); + m = (m != NULL && m->pindex == sb->p + i - 1) ? + vm_page_next(m) : + vm_page_lookup(srcobject, sb->p + i); if (m == NULL || vm_page_none_valid(m)) mc++; }