diff options
| author | David Hildenbrand <[email protected]> | 2024-05-22 14:57:13 +0200 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-07-03 19:29:56 -0700 |
| commit | 6ad28e7e52e2bae76b1d3eb4466999d04d50db92 (patch) | |
| tree | 7b0c5f9a48051272b7f3486092bef1dae0646353 /include/linux | |
| parent | fce831c92092ad898d559e8657ec3e84e281160b (diff) | |
mm/rmap: sanity check that zeropages are not passed to RMAP
Using insert_page() we might have previously ended up passing the zeropage
into rmap code. Make sure that won't happen again.
Note that we won't check the huge zeropage for now, which might still end
up in RMAP code.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: David Hildenbrand <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Vincent Donnefort <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/rmap.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 7229b9baf20d..5cb0d419a1d7 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -200,6 +200,9 @@ static inline void __folio_rmap_sanity_checks(struct folio *folio, /* hugetlb folios are handled separately. */ VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio); + /* When (un)mapping zeropages, we should never touch ref+mapcount. */ + VM_WARN_ON_FOLIO(is_zero_folio(folio), folio); + /* * TODO: we get driver-allocated folios that have nothing to do with * the rmap using vm_insert_page(); therefore, we cannot assume that |