1==============================
2Unevictable LRU Infrastructure
3==============================
4
5.. contents:: :local:
6
7
8Introduction
9============
10
11This document describes the Linux memory manager's "Unevictable LRU"
12infrastructure and the use of this to manage several types of "unevictable"
13folios.
14
15The document attempts to provide the overall rationale behind this mechanism
16and the rationale for some of the design decisions that drove the
17implementation.  The latter design rationale is discussed in the context of an
18implementation description.  Admittedly, one can obtain the implementation
19details - the "what does it do?" - by reading the code.  One hopes that the
20descriptions below add value by provide the answer to "why does it do that?".
21
22
23
24The Unevictable LRU
25===================
26
27The Unevictable LRU facility adds an additional LRU list to track unevictable
28folios and to hide these folios from vmscan.  This mechanism is based on a patch
29by Larry Woodman of Red Hat to address several scalability problems with folio
30reclaim in Linux.  The problems have been observed at customer sites on large
31memory x86_64 systems.
32
33To illustrate this with an example, a non-NUMA x86_64 platform with 128GB of
34main memory will have over 32 million 4k pages in a single node.  When a large
35fraction of these pages are not evictable for any reason [see below], vmscan
36will spend a lot of time scanning the LRU lists looking for the small fraction
37of pages that are evictable.  This can result in a situation where all CPUs are
38spending 100% of their time in vmscan for hours or days on end, with the system
39completely unresponsive.
40
41The unevictable list addresses the following classes of unevictable pages:
42
43 * Those owned by ramfs.
44
45 * Those mapped into SHM_LOCK'd shared memory regions.
46
47 * Those mapped into VM_LOCKED [mlock()ed] VMAs.
48
49The infrastructure may also be able to handle other conditions that make pages
50unevictable, either by definition or by circumstance, in the future.
51
52
53The Unevictable LRU Folio List
54------------------------------
55
56The Unevictable LRU folio list is a lie.  It was never an LRU-ordered
57list, but a companion to the LRU-ordered anonymous and file, active and
58inactive folio lists; and now it is not even a folio list.  But following
59familiar convention, here in this document and in the source, we often
60imagine it as a fifth LRU folio list.
61
62The Unevictable LRU infrastructure consists of an additional, per-node, LRU list
63called the "unevictable" list and an associated folio flag, PG_unevictable, to
64indicate that the folio is being managed on the unevictable list.
65
66The PG_unevictable flag is analogous to, and mutually exclusive with, the
67PG_active flag in that it indicates on which LRU list a folio resides when
68PG_lru is set.
69
70The Unevictable LRU infrastructure maintains unevictable folios as if they were
71on an additional LRU list for a few reasons:
72
73 (1) We get to "treat unevictable folios just like we treat other folios in the
74     system - which means we get to use the same code to manipulate them, the
75     same code to isolate them (for migrate, etc.), the same code to keep track
76     of the statistics, etc..." [Rik van Riel]
77
78 (2) We want to be able to migrate unevictable folios between nodes for memory
79     defragmentation, workload management and memory hotplug.  The Linux kernel
80     can only migrate folios that it can successfully isolate from the LRU
81     lists (or "Movable" pages: outside of consideration here).  If we were to
82     maintain folios elsewhere than on an LRU-like list, where they can be
83     detected by folio_isolate_lru(), we would prevent their migration.
84
85The unevictable list does not differentiate between file-backed and
86anonymous, swap-backed folios.  This differentiation is only important
87while the folios are, in fact, evictable.
88
89The unevictable list benefits from the "arrayification" of the per-node LRU
90lists and statistics originally proposed and posted by Christoph Lameter.
91
92
93Memory Control Group Interaction
94--------------------------------
95
96The unevictable LRU facility interacts with the memory control group [aka
97memory controller; see Documentation/admin-guide/cgroup-v1/memory.rst] by
98extending the lru_list enum.
99
100The memory controller data structure automatically gets a per-node unevictable
101list as a result of the "arrayification" of the per-node LRU lists (one per
102lru_list enum element).  The memory controller tracks the movement of pages to
103and from the unevictable list.
104
105When a memory control group comes under memory pressure, the controller will
106not attempt to reclaim pages on the unevictable list.  This has a couple of
107effects:
108
109 (1) Because the pages are "hidden" from reclaim on the unevictable list, the
110     reclaim process can be more efficient, dealing only with pages that have a
111     chance of being reclaimed.
112
113 (2) On the other hand, if too many of the pages charged to the control group
114     are unevictable, the evictable portion of the working set of the tasks in
115     the control group may not fit into the available memory.  This can cause
116     the control group to thrash or to OOM-kill tasks.
117
118
119.. _mark_addr_space_unevict:
120
121Marking Address Spaces Unevictable
122----------------------------------
123
124For facilities such as ramfs none of the pages attached to the address space
125may be evicted.  To prevent eviction of any such pages, the AS_UNEVICTABLE
126address space flag is provided, and this can be manipulated by a filesystem
127using a number of wrapper functions:
128
129 * ``void mapping_set_unevictable(struct address_space *mapping);``
130
131	Mark the address space as being completely unevictable.
132
133 * ``void mapping_clear_unevictable(struct address_space *mapping);``
134
135	Mark the address space as being evictable.
136
137 * ``int mapping_unevictable(struct address_space *mapping);``
138
139	Query the address space, and return true if it is completely
140	unevictable.
141
142These are currently used in three places in the kernel:
143
144 (1) By ramfs to mark the address spaces of its inodes when they are created,
145     and this mark remains for the life of the inode.
146
147 (2) By SYSV SHM to mark SHM_LOCK'd address spaces until SHM_UNLOCK is called.
148     Note that SHM_LOCK is not required to page in the locked pages if they're
149     swapped out; the application must touch the pages manually if it wants to
150     ensure they're in memory.
151
152 (3) By the i915 driver to mark pinned address space until it's unpinned. The
153     amount of unevictable memory marked by i915 driver is roughly the bounded
154     object size in debugfs/dri/0/i915_gem_objects.
155
156
157Detecting Unevictable Pages
158---------------------------
159
160The function folio_evictable() in mm/internal.h determines whether a folio is
161evictable or not using the query function outlined above [see section
162:ref:`Marking address spaces unevictable <mark_addr_space_unevict>`]
163to check the AS_UNEVICTABLE flag.
164
165For address spaces that are so marked after being populated (as SHM regions
166might be), the lock action (e.g. SHM_LOCK) can be lazy, and need not populate
167the page tables for the region as does, for example, mlock(), nor need it make
168any special effort to push any pages in the SHM_LOCK'd area to the unevictable
169list.  Instead, vmscan will do this if and when it encounters the folios during
170a reclamation scan.
171
172On an unlock action (such as SHM_UNLOCK), the unlocker (e.g. shmctl()) must scan
173the pages in the region and "rescue" them from the unevictable list if no other
174condition is keeping them unevictable.  If an unevictable region is destroyed,
175the pages are also "rescued" from the unevictable list in the process of
176freeing them.
177
178folio_evictable() also checks for mlocked folios by calling
179folio_test_mlocked(), which is set when a folio is faulted into a
180VM_LOCKED VMA, or found in a VMA being VM_LOCKED.
181
182
183Vmscan's Handling of Unevictable Folios
184---------------------------------------
185
186If unevictable folios are culled in the fault path, or moved to the unevictable
187list at mlock() or mmap() time, vmscan will not encounter the folios until they
188have become evictable again (via munlock() for example) and have been "rescued"
189from the unevictable list.  However, there may be situations where we decide,
190for the sake of expediency, to leave an unevictable folio on one of the regular
191active/inactive LRU lists for vmscan to deal with.  vmscan checks for such
192folios in all of the shrink_{active|inactive|page}_list() functions and will
193"cull" such folios that it encounters: that is, it diverts those folios to the
194unevictable list for the memory cgroup and node being scanned.
195
196There may be situations where a folio is mapped into a VM_LOCKED VMA,
197but the folio does not have the mlocked flag set.  Such folios will make
198it all the way to shrink_active_list() or shrink_page_list() where they
199will be detected when vmscan walks the reverse map in folio_referenced()
200or try_to_unmap().  The folio is culled to the unevictable list when it
201is released by the shrinker.
202
203To "cull" an unevictable folio, vmscan simply puts the folio back on
204the LRU list using folio_putback_lru() - the inverse operation to
205folio_isolate_lru() - after dropping the folio lock.  Because the
206condition which makes the folio unevictable may change once the folio
207is unlocked, __pagevec_lru_add_fn() will recheck the unevictable state
208of a folio before placing it on the unevictable list.
209
210
211MLOCKED Pages
212=============
213
214The unevictable folio list is also useful for mlock(), in addition to ramfs and
215SYSV SHM.  Note that mlock() is only available in CONFIG_MMU=y situations; in
216NOMMU situations, all mappings are effectively mlocked.
217
218
219History
220-------
221
222The "Unevictable mlocked Pages" infrastructure is based on work originally
223posted by Nick Piggin in an RFC patch entitled "mm: mlocked pages off LRU".
224Nick posted his patch as an alternative to a patch posted by Christoph Lameter
225to achieve the same objective: hiding mlocked pages from vmscan.
226
227In Nick's patch, he used one of the struct page LRU list link fields as a count
228of VM_LOCKED VMAs that map the page (Rik van Riel had the same idea three years
229earlier).  But this use of the link field for a count prevented the management
230of the pages on an LRU list, and thus mlocked pages were not migratable as
231isolate_lru_page() could not detect them, and the LRU list link field was not
232available to the migration subsystem.
233
234Nick resolved this by putting mlocked pages back on the LRU list before
235attempting to isolate them, thus abandoning the count of VM_LOCKED VMAs.  When
236Nick's patch was integrated with the Unevictable LRU work, the count was
237replaced by walking the reverse map when munlocking, to determine whether any
238other VM_LOCKED VMAs still mapped the page.
239
240However, walking the reverse map for each page when munlocking was ugly and
241inefficient, and could lead to catastrophic contention on a file's rmap lock,
242when many processes which had it mlocked were trying to exit.  In 5.18, the
243idea of keeping mlock_count in Unevictable LRU list link field was revived and
244put to work, without preventing the migration of mlocked pages.  This is why
245the "Unevictable LRU list" cannot be a linked list of pages now; but there was
246no use for that linked list anyway - though its size is maintained for meminfo.
247
248
249Basic Management
250----------------
251
252mlocked pages - pages mapped into a VM_LOCKED VMA - are a class of unevictable
253pages.  When such a page has been "noticed" by the memory management subsystem,
254the page is marked with the PG_mlocked flag.  This can be manipulated using the
255PageMlocked() functions.
256
257A PG_mlocked page will be placed on the unevictable list when it is added to
258the LRU.  Such pages can be "noticed" by memory management in several places:
259
260 (1) in the mlock()/mlock2()/mlockall() system call handlers;
261
262 (2) in the mmap() system call handler when mmapping a region with the
263     MAP_LOCKED flag;
264
265 (3) mmapping a region in a task that has called mlockall() with the MCL_FUTURE
266     flag;
267
268 (4) in the fault path and when a VM_LOCKED stack segment is expanded; or
269
270 (5) as mentioned above, in vmscan:shrink_page_list() when attempting to
271     reclaim a page in a VM_LOCKED VMA by folio_referenced() or try_to_unmap().
272
273mlocked pages become unlocked and rescued from the unevictable list when:
274
275 (1) mapped in a range unlocked via the munlock()/munlockall() system calls;
276
277 (2) munmap()'d out of the last VM_LOCKED VMA that maps the page, including
278     unmapping at task exit;
279
280 (3) when the page is truncated from the last VM_LOCKED VMA of an mmapped file;
281     or
282
283 (4) before a page is COW'd in a VM_LOCKED VMA.
284
285
286mlock()/mlock2()/mlockall() System Call Handling
287------------------------------------------------
288
289mlock(), mlock2() and mlockall() system call handlers proceed to mlock_fixup()
290for each VMA in the range specified by the call.  In the case of mlockall(),
291this is the entire active address space of the task.  Note that mlock_fixup()
292is used for both mlocking and munlocking a range of memory.  A call to mlock()
293an already VM_LOCKED VMA, or to munlock() a VMA that is not VM_LOCKED, is
294treated as a no-op and mlock_fixup() simply returns.
295
296If the VMA passes some filtering as described in "Filtering Special VMAs"
297below, mlock_fixup() will attempt to merge the VMA with its neighbors or split
298off a subset of the VMA if the range does not cover the entire VMA.  Any pages
299already present in the VMA are then marked as mlocked by mlock_folio() via
300mlock_pte_range() via walk_page_range() via mlock_vma_pages_range().
301
302Before returning from the system call, do_mlock() or mlockall() will call
303__mm_populate() to fault in the remaining pages via get_user_pages() and to
304mark those pages as mlocked as they are faulted.
305
306Note that the VMA being mlocked might be mapped with PROT_NONE.  In this case,
307get_user_pages() will be unable to fault in the pages.  That's okay.  If pages
308do end up getting faulted into this VM_LOCKED VMA, they will be handled in the
309fault path - which is also how mlock2()'s MLOCK_ONFAULT areas are handled.
310
311For each PTE (or PMD) being faulted into a VMA, the page add rmap function
312calls mlock_vma_folio(), which calls mlock_folio() when the VMA is VM_LOCKED
313(unless it is a PTE mapping of a part of a transparent huge page).  Or when
314it is a newly allocated anonymous page, folio_add_lru_vma() calls
315mlock_new_folio() instead: similar to mlock_folio(), but can make better
316judgments, since this page is held exclusively and known not to be on LRU yet.
317
318mlock_folio() sets PG_mlocked immediately, then places the page on the CPU's
319mlock folio batch, to batch up the rest of the work to be done under lru_lock by
320__mlock_folio().  __mlock_folio() sets PG_unevictable, initializes mlock_count
321and moves the page to unevictable state ("the unevictable LRU", but with
322mlock_count in place of LRU threading).  Or if the page was already PG_lru
323and PG_unevictable and PG_mlocked, it simply increments the mlock_count.
324
325But in practice that may not work ideally: the page may not yet be on an LRU, or
326it may have been temporarily isolated from LRU.  In such cases the mlock_count
327field cannot be touched, but will be set to 0 later when __munlock_folio()
328returns the page to "LRU".  Races prohibit mlock_count from being set to 1 then:
329rather than risk stranding a page indefinitely as unevictable, always err with
330mlock_count on the low side, so that when munlocked the page will be rescued to
331an evictable LRU, then perhaps be mlocked again later if vmscan finds it in a
332VM_LOCKED VMA.
333
334
335Filtering Special VMAs
336----------------------
337
338mlock_fixup() filters several classes of "special" VMAs:
339
3401) VMAs with VM_IO or VM_PFNMAP set are skipped entirely.  The pages behind
341   these mappings are inherently pinned, so we don't need to mark them as
342   mlocked.  In any case, most of the pages have no struct page in which to so
343   mark the page.  Because of this, get_user_pages() will fail for these VMAs,
344   so there is no sense in attempting to visit them.
345
3462) VMAs mapping hugetlbfs page are already effectively pinned into memory.  We
347   neither need nor want to mlock() these pages.  But __mm_populate() includes
348   hugetlbfs ranges, allocating the huge pages and populating the PTEs.
349
3503) VMAs with VM_DONTEXPAND are generally userspace mappings of kernel pages,
351   such as the VDSO page, relay channel pages, etc.  These pages are inherently
352   unevictable and are not managed on the LRU lists.  __mm_populate() includes
353   these ranges, populating the PTEs if not already populated.
354
3554) VMAs with VM_MIXEDMAP set are not marked VM_LOCKED, but __mm_populate()
356   includes these ranges, populating the PTEs if not already populated.
357
358Note that for all of these special VMAs, mlock_fixup() does not set the
359VM_LOCKED flag.  Therefore, we won't have to deal with them later during
360munlock(), munmap() or task exit.  Neither does mlock_fixup() account these
361VMAs against the task's "locked_vm".
362
363
364munlock()/munlockall() System Call Handling
365-------------------------------------------
366
367The munlock() and munlockall() system calls are handled by the same
368mlock_fixup() function as mlock(), mlock2() and mlockall() system calls are.
369If called to munlock an already munlocked VMA, mlock_fixup() simply returns.
370Because of the VMA filtering discussed above, VM_LOCKED will not be set in
371any "special" VMAs.  So, those VMAs will be ignored for munlock.
372
373If the VMA is VM_LOCKED, mlock_fixup() again attempts to merge or split off the
374specified range.  All pages in the VMA are then munlocked by munlock_folio() via
375mlock_pte_range() via walk_page_range() via mlock_vma_pages_range() - the same
376function used when mlocking a VMA range, with new flags for the VMA indicating
377that it is munlock() being performed.
378
379munlock_folio() uses the mlock pagevec to batch up work to be done
380under lru_lock by  __munlock_folio().  __munlock_folio() decrements the
381folio's mlock_count, and when that reaches 0 it clears the mlocked flag
382and clears the unevictable flag, moving the folio from unevictable state
383to the inactive LRU.
384
385But in practice that may not work ideally: the folio may not yet have reached
386"the unevictable LRU", or it may have been temporarily isolated from it.  In
387those cases its mlock_count field is unusable and must be assumed to be 0: so
388that the folio will be rescued to an evictable LRU, then perhaps be mlocked
389again later if vmscan finds it in a VM_LOCKED VMA.
390
391
392Migrating MLOCKED Pages
393-----------------------
394
395A page that is being migrated has been isolated from the LRU lists and is held
396locked across unmapping of the page, updating the page's address space entry
397and copying the contents and state, until the page table entry has been
398replaced with an entry that refers to the new page.  Linux supports migration
399of mlocked pages and other unevictable pages.  PG_mlocked is cleared from the
400the old page when it is unmapped from the last VM_LOCKED VMA, and set when the
401new page is mapped in place of migration entry in a VM_LOCKED VMA.  If the page
402was unevictable because mlocked, PG_unevictable follows PG_mlocked; but if the
403page was unevictable for other reasons, PG_unevictable is copied explicitly.
404
405Note that page migration can race with mlocking or munlocking of the same page.
406There is mostly no problem since page migration requires unmapping all PTEs of
407the old page (including munlock where VM_LOCKED), then mapping in the new page
408(including mlock where VM_LOCKED).  The page table locks provide sufficient
409synchronization.
410
411However, since mlock_vma_pages_range() starts by setting VM_LOCKED on a VMA,
412before mlocking any pages already present, if one of those pages were migrated
413before mlock_pte_range() reached it, it would get counted twice in mlock_count.
414To prevent that, mlock_vma_pages_range() temporarily marks the VMA as VM_IO,
415so that mlock_vma_folio() will skip it.
416
417To complete page migration, we place the old and new pages back onto the LRU
418afterwards.  The "unneeded" page - old page on success, new page on failure -
419is freed when the reference count held by the migration process is released.
420
421
422Compacting MLOCKED Pages
423------------------------
424
425The memory map can be scanned for compactable regions and the default behavior
426is to let unevictable pages be moved.  /proc/sys/vm/compact_unevictable_allowed
427controls this behavior (see Documentation/admin-guide/sysctl/vm.rst).  The work
428of compaction is mostly handled by the page migration code and the same work
429flow as described in Migrating MLOCKED Pages will apply.
430
431
432MLOCKING Transparent Huge Pages
433-------------------------------
434
435A transparent huge page is represented by a single entry on an LRU list.
436Therefore, we can only make unevictable an entire compound page, not
437individual subpages.
438
439If a user tries to mlock() part of a huge page, and no user mlock()s the
440whole of the huge page, we want the rest of the page to be reclaimable.
441
442We cannot just split the page on partial mlock() as split_huge_page() can
443fail and a new intermittent failure mode for the syscall is undesirable.
444
445We handle this by keeping PTE-mlocked huge pages on evictable LRU lists:
446the PMD on the border of a VM_LOCKED VMA will be split into a PTE table.
447
448This way the huge page is accessible for vmscan.  Under memory pressure the
449page will be split, subpages which belong to VM_LOCKED VMAs will be moved
450to the unevictable LRU and the rest can be reclaimed.
451
452/proc/meminfo's Unevictable and Mlocked amounts do not include those parts
453of a transparent huge page which are mapped only by PTEs in VM_LOCKED VMAs.
454
455
456mmap(MAP_LOCKED) System Call Handling
457-------------------------------------
458
459In addition to the mlock(), mlock2() and mlockall() system calls, an application
460can request that a region of memory be mlocked by supplying the MAP_LOCKED flag
461to the mmap() call.  There is one important and subtle difference here, though.
462mmap() + mlock() will fail if the range cannot be faulted in (e.g. because
463mm_populate fails) and returns with ENOMEM while mmap(MAP_LOCKED) will not fail.
464The mmaped area will still have properties of the locked area - pages will not
465get swapped out - but major page faults to fault memory in might still happen.
466
467Furthermore, any mmap() call or brk() call that expands the heap by a task
468that has previously called mlockall() with the MCL_FUTURE flag will result
469in the newly mapped memory being mlocked.  Before the unevictable/mlock
470changes, the kernel simply called make_pages_present() to allocate pages
471and populate the page table.
472
473To mlock a range of memory under the unevictable/mlock infrastructure,
474the mmap() handler and task address space expansion functions call
475populate_vma_page_range() specifying the vma and the address range to mlock.
476
477
478munmap()/exit()/exec() System Call Handling
479-------------------------------------------
480
481When unmapping an mlocked region of memory, whether by an explicit call to
482munmap() or via an internal unmap from exit() or exec() processing, we must
483munlock the pages if we're removing the last VM_LOCKED VMA that maps the pages.
484Before the unevictable/mlock changes, mlocking did not mark the pages in any
485way, so unmapping them required no processing.
486
487For each PTE (or PMD) being unmapped from a VMA, page_remove_rmap() calls
488munlock_vma_folio(), which calls munlock_folio() when the VMA is VM_LOCKED
489(unless it was a PTE mapping of a part of a transparent huge page).
490
491munlock_folio() uses the mlock pagevec to batch up work to be done
492under lru_lock by  __munlock_folio().  __munlock_folio() decrements the
493folio's mlock_count, and when that reaches 0 it clears the mlocked flag
494and clears the unevictable flag, moving the folio from unevictable state
495to the inactive LRU.
496
497But in practice that may not work ideally: the folio may not yet have reached
498"the unevictable LRU", or it may have been temporarily isolated from it.  In
499those cases its mlock_count field is unusable and must be assumed to be 0: so
500that the folio will be rescued to an evictable LRU, then perhaps be mlocked
501again later if vmscan finds it in a VM_LOCKED VMA.
502
503
504Truncating MLOCKED Pages
505------------------------
506
507File truncation or hole punching forcibly unmaps the deleted pages from
508userspace; truncation even unmaps and deletes any private anonymous pages
509which had been Copied-On-Write from the file pages now being truncated.
510
511Mlocked pages can be munlocked and deleted in this way: like with munmap(),
512for each PTE (or PMD) being unmapped from a VMA, page_remove_rmap() calls
513munlock_vma_folio(), which calls munlock_folio() when the VMA is VM_LOCKED
514(unless it was a PTE mapping of a part of a transparent huge page).
515
516However, if there is a racing munlock(), since mlock_vma_pages_range() starts
517munlocking by clearing VM_LOCKED from a VMA, before munlocking all the pages
518present, if one of those pages were unmapped by truncation or hole punch before
519mlock_pte_range() reached it, it would not be recognized as mlocked by this VMA,
520and would not be counted out of mlock_count.  In this rare case, a page may
521still appear as PG_mlocked after it has been fully unmapped: and it is left to
522release_pages() (or __page_cache_release()) to clear it and update statistics
523before freeing (this event is counted in /proc/vmstat unevictable_pgs_cleared,
524which is usually 0).
525
526
527Page Reclaim in shrink_*_list()
528-------------------------------
529
530vmscan's shrink_active_list() culls any obviously unevictable pages -
531i.e. !page_evictable(page) pages - diverting those to the unevictable list.
532However, shrink_active_list() only sees unevictable pages that made it onto the
533active/inactive LRU lists.  Note that these pages do not have PG_unevictable
534set - otherwise they would be on the unevictable list and shrink_active_list()
535would never see them.
536
537Some examples of these unevictable pages on the LRU lists are:
538
539 (1) ramfs pages that have been placed on the LRU lists when first allocated.
540
541 (2) SHM_LOCK'd shared memory pages.  shmctl(SHM_LOCK) does not attempt to
542     allocate or fault in the pages in the shared memory region.  This happens
543     when an application accesses the page the first time after SHM_LOCK'ing
544     the segment.
545
546 (3) pages still mapped into VM_LOCKED VMAs, which should be marked mlocked,
547     but events left mlock_count too low, so they were munlocked too early.
548
549vmscan's shrink_inactive_list() and shrink_page_list() also divert obviously
550unevictable pages found on the inactive lists to the appropriate memory cgroup
551and node unevictable list.
552
553rmap's folio_referenced_one(), called via vmscan's shrink_active_list() or
554shrink_page_list(), and rmap's try_to_unmap_one() called via shrink_page_list(),
555check for (3) pages still mapped into VM_LOCKED VMAs, and call mlock_vma_folio()
556to correct them.  Such pages are culled to the unevictable list when released
557by the shrinker.
558