opnsense-src/sys/vm
Mark Johnston 33d7d5e7cb 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.

Approved by:	so
Security:	FreeBSD-EN-22:23.vm
PR:		256507
Fixes:		f3f38e2580 ("Start implementing queue state updates using fcmpset loops.")
Reviewed by:	alc, kib
Sponsored by:	E-CARD Ltd.
Sponsored by:	Klara, Inc.

(cherry picked from commit 2c9dc2384f)
(cherry picked from commit 6094749a1a)
2022-11-02 08:41:02 +01:00
..
_vm_phys.h
_vm_radix.h
default_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-22 12:38:30 +03:00
device_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-22 12:38:30 +03:00
memguard.c
memguard.h
phys_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-22 12:38:30 +03:00
pmap.h
redzone.c redzone: Raise a compile error if KASAN is configured 2021-11-01 10:07:31 -04:00
redzone.h
sg_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-22 12:38:30 +03:00
swap_pager.c swap_pager: uma_zcreate() doesn't fail 2022-01-18 08:36:13 -05:00
swap_pager.h swapoff: add one more variant of the syscall 2021-12-20 02:29:11 +02:00
uma.h uma: Add UMA_ZONE_UNMANAGED 2022-02-24 10:59:28 +01:00
uma_core.c uma: Add UMA_ZONE_UNMANAGED 2022-02-24 10:59:28 +01:00
uma_dbg.c
uma_dbg.h
uma_int.h Improve UMA cache reclamation. 2021-05-15 22:10:48 -04:00
vm.h tmpfs: dynamically register tmpfs pager 2021-05-22 12:38:30 +03:00
vm_domainset.c
vm_domainset.h
vm_dumpset.h minidump: Use the provided dump bitset 2021-12-03 10:02:03 -04:00
vm_extern.h vm/vm_extern.h, vm/vm_page.h: use sys/kassert.h 2022-02-08 08:42:07 +02:00
vm_fault.c vm_fault: Shoot down shared mappings in vm_fault_copy_entry() 2022-08-12 11:15:55 +02:00
vm_glue.c Fix a common typo in syctl descriptions 2021-11-06 08:52:57 +01:00
vm_init.c
vm_kern.c Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). 2021-11-03 13:39:36 -04:00
vm_kern.h
vm_map.c Use vmspace->vm_stacktop in place of sv_usrstack in more places. 2022-02-16 11:55:37 -05:00
vm_map.h exec: Reimplement stack address randomization 2022-02-16 11:55:03 -05:00
vm_meter.c vmmeter(): Fix detection of the named swap objects 2022-02-09 02:42:44 +02:00
vm_mmap.c Add OBJT_SWAP_TMPFS pager 2021-05-22 12:38:29 +03:00
vm_object.c vm_object: restore handling of shadow_count for all type of objects 2022-02-09 02:42:44 +02:00
vm_object.h vm_object: Make is_object_active() global 2022-02-09 02:42:44 +02:00
vm_page.c vm_page: Fix a logic error in the handling of PQ_ACTIVE operations 2022-11-02 08:41:02 +01:00
vm_page.h vm/vm_extern.h, vm/vm_page.h: use sys/kassert.h 2022-02-08 08:42:07 +02:00
vm_pageout.c vm_pageout: Print a more accurate message to the console before an OOM kill 2022-02-28 09:06:58 -05:00
vm_pageout.h
vm_pagequeue.h
vm_pager.c Use dedicated lock name for pbufs 2022-02-07 11:38:49 +02:00
vm_pager.h vm/vm_pager.h: use sys/systm.h header 2022-02-08 08:42:07 +02:00
vm_param.h
vm_phys.c minidump: De-duplicate is_dumpable() 2021-10-15 12:20:48 -03:00
vm_phys.h minidump: De-duplicate is_dumpable() 2021-10-15 12:20:48 -03:00
vm_radix.c
vm_radix.h
vm_reserv.c vm_reserv: fix zero-boundary error 2021-12-29 11:23:48 -06:00
vm_reserv.h
vm_swapout.c Make vmdaemon timeout configurable 2022-02-14 19:28:56 +00:00
vm_swapout_dummy.c
vm_unix.c
vnode_pager.c vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops 2021-05-22 12:38:30 +03:00
vnode_pager.h