freebsd-dev/sys/vm
Mark Johnston 2c9dc2384f vm_page: Fix a logic error in the handling of PQ_ACTIVE operations
As an optimization, vm_page_activate() avoids requeuing a page that's
already in the active queue.  A page's location in the active queue is
mostly unimportant.

When a page is unwired and placed back in the page queues,
vm_page_unwire() avoids moving pages out of PQ_ACTIVE to honour the
request, the idea being that they're likely mapped and so will simply
get bounced back in to PQ_ACTIVE during a queue scan.

In both cases, if the page was logically in PQ_ACTIVE but had not yet
been physically enqueued (i.e., the page is in a per-CPU batch), we
would end up clearing PGA_REQUEUE from the page.  Then, batch processing
would ignore the page, so it would end up unwired and not in any queues.
This can arise, for example, when a page is allocated and then
vm_page_activate() is called multiple times in quick succession.  The
result is that the page is hidden from the page daemon, so while it will
be freed when its VM object is destroyed, it cannot be reclaimed under
memory pressure.

Fix the bug: when checking if a page is in PQ_ACTIVE, only perform the
optimization if the page is physically enqueued.

PR:		256507
Fixes:		f3f38e2580 ("Start implementing queue state updates using fcmpset loops.")
Reviewed by:	alc, kib
MFC after:	1 week
Sponsored by:	E-CARD Ltd.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D36839
2022-10-05 15:12:46 -04:00
..
_vm_phys.h
_vm_radix.h
device_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-13 20:10:35 +03:00
memguard.c memguard(9): Fix two typos in source code comments 2022-04-02 13:51:27 +02:00
memguard.h
phys_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-13 20:10:35 +03:00
pmap.h
redzone.c redzone: Raise a compile error if KASAN is configured 2021-07-23 10:47:13 -04:00
redzone.h
sg_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-13 20:10:35 +03:00
swap_pager.c swap_pager: style, wrap long lines 2022-09-16 23:23:13 +03:00
swap_pager.h swapoff: add one more variant of the syscall 2021-12-09 02:48:46 +02:00
uma_core.c kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers. 2022-09-22 15:09:19 -07:00
uma_dbg.c
uma_dbg.h
uma_int.h Improve UMA cache reclamation. 2021-05-02 19:45:23 -04:00
uma.h uma: Add UMA_ZONE_UNMANAGED 2022-02-15 09:25:34 -05:00
vm_domainset.c
vm_domainset.h
vm_dumpset.h Fix various places which cast a pointer to a vm_paddr_t or vice versa. 2022-10-03 16:10:41 -07:00
vm_extern.h kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers. 2022-09-22 15:09:19 -07:00
vm_fault.c vm_fault: Shoot down shared mappings in vm_fault_copy_entry() 2022-08-09 15:44:45 -04:00
vm_glue.c Remove special kstack allocation code for mips. 2022-01-06 04:43:56 +02:00
vm_init.c kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers. 2022-09-22 15:09:19 -07:00
vm_kern.c kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers. 2022-09-22 15:09:19 -07:00
vm_kern.h
vm_map.c Rework how shared page related data is stored 2022-07-18 16:27:32 +02:00
vm_map.h Rework how shared page related data is stored 2022-07-18 16:27:32 +02:00
vm_meter.c vmmeter(): Fix detection of the named swap objects 2022-02-02 11:39:58 +02:00
vm_mmap.c vm: Remove handling for OBJT_DEFAULT objects 2022-07-17 07:09:48 -04:00
vm_object.c ddb: annotate some commands with DB_CMD_MEMSAFE 2022-07-18 22:06:09 +00:00
vm_object.h vm_object: Modify vm_object_allocate_anon() to return OBJT_SWAP objects 2022-07-17 07:09:48 -04:00
vm_page.c vm_page: Fix a logic error in the handling of PQ_ACTIVE operations 2022-10-05 15:12:46 -04:00
vm_page.h vm/vm_extern.h, vm/vm_page.h: use sys/kassert.h 2022-02-01 05:55:35 +02:00
vm_pageout.c vm: Remove handling for OBJT_DEFAULT objects 2022-07-17 07:09:48 -04:00
vm_pageout.h protosw: retire pr_drain and use EVENTHANDLER(9) directly 2022-08-17 11:50:31 -07:00
vm_pagequeue.h
vm_pager.c sys/vm: Add TSLOG to some functions 2022-08-12 16:53:04 -07:00
vm_pager.h vm/vm_pager.h: use sys/systm.h header 2022-02-01 05:55:35 +02:00
vm_param.h
vm_phys.c ddb: annotate some commands with DB_CMD_MEMSAFE 2022-07-18 22:06:09 +00:00
vm_phys.h vm_phys: hide vm_phys_set_pool 2021-12-29 11:17:33 -06:00
vm_radix.c
vm_radix.h
vm_reserv.c vm_reserv: use enhanced bitstring for popmaps 2022-01-12 11:03:53 -06:00
vm_reserv.h vm: alloc pages from reserv before breaking it 2021-12-24 12:59:16 -06:00
vm_swapout_dummy.c
vm_swapout.c vm: Use __diagused for variables only used in KASSERT(). 2022-04-13 16:08:20 -07:00
vm_unix.c
vm.h vm/vm.h: cleanup 2022-09-17 11:58:52 +03:00
vnode_pager.c vm: Use __diagused for variables only used in KASSERT(). 2022-04-13 16:08:20 -07:00
vnode_pager.h