git: d11d407aee48 - main - swap_pager: Ensure that swapoff puts swapped-in pages in page queues

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 13 Nov 2024 14:15:17 UTC
The branch main has been updated by markj:

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

commit d11d407aee4835fd50811a5980125bb46748fa0b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-13 14:02:20 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-13 14:14:32 +0000

    swap_pager: Ensure that swapoff puts swapped-in pages in page queues
    
    Readahead/behind pages are handled by the swap pager, but the get_pages
    caller is responsible for putting fetched pages into queues (or wiring
    them beforehand).
    
    Note that the VM object lock prevents the newly queued page from being
    immediately reclaimed in the window before it is marked dirty by
    swap_pager_swapoff_object().
    
    Reported by:    pho
    Tested by:      pho
    Reviewed by:    dougm, alc, kib
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D47526
---
 sys/vm/swap_pager.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index a402516fdb0e..db925f4ae7f6 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -1998,6 +1998,7 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object)
 			vm_object_pip_wakeupn(object, 1);
 			KASSERT(vm_page_all_valid(m),
 			    ("%s: Page %p not all valid", __func__, m));
+			vm_page_deactivate_noreuse(m);
 			vm_page_xunbusy(m);
 			break;
 		}