1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

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
This commit is contained in:
Doug Moore 2024-08-07 03:37:18 -05:00
parent 9ed58aa60f
commit e413e15c1a

View File

@ -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++;
}