Hugh Dickins b1454b463c mm: mlock: avoid folio_within_range() on KSM pages
Since commit dc68badcede4 ("mm: mlock: update mlock_pte_range to handle
large folio") I've just occasionally seen VM_WARN_ON_FOLIO(folio_test_ksm)
warnings from folio_within_range(), in a splurge after testing with KSM
hyperactive.

folio_referenced_one()'s use of folio_within_vma() is safe because it
checks folio_test_large() first; but allow_mlock_munlock() needs to do the
same to avoid those warnings (or check !folio_test_ksm() itself?  Or move
either check into folio_within_range()?  Hard to tell without more
examples of its use).

Link: https://lkml.kernel.org/r/23852f6a-5bfa-1ffd-30db-30c5560ad426@google.com
Fixes: dc68badcede4 ("mm: mlock: update mlock_pte_range to handle large folio")
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Stefan Roesch <shr@devkernel.io>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-10-25 16:47:14 -07:00
..
2023-09-08 12:16:52 -07:00
2023-06-09 16:25:17 -07:00
2023-07-24 18:04:30 -04:00
2023-06-19 16:19:25 -07:00
2023-10-16 15:44:39 -07:00
2023-04-12 17:36:23 -07:00
2023-08-31 12:20:12 -07:00
2022-10-03 14:02:43 -07:00
2023-10-25 16:47:13 -07:00
2023-10-25 16:47:11 -07:00
2021-05-07 00:26:35 -07:00
2023-10-04 10:32:19 -07:00
2023-09-29 12:10:12 -07:00
2023-07-18 10:07:47 +02:00
2023-10-25 16:47:11 -07:00
2023-07-14 09:57:21 +02:00
2023-06-23 16:59:30 -07:00
2023-04-12 17:36:23 -07:00
2023-08-31 12:20:12 -07:00
2023-10-25 16:47:10 -07:00