Commit 3af4006
mm/rmap: simplify PageAnonExclusive sanity checks when adding anon rmap
mainline inclusion
from mainline-v6.7-rc1
category: performance
Let's sanity-check PageAnonExclusive vs. mapcount in page_add_anon_rmap()
and hugepage_add_anon_rmap() after setting PageAnonExclusive simply by
re-reading the mapcounts.
We can stop initializing the "first" variable in page_add_anon_rmap() and
no longer need an atomic_inc_and_test() in hugepage_add_anon_rmap().
While at it, switch to VM_WARN_ON_FOLIO().
[david@redhat.com: update check for doubly-mapped page]
Link: https://lkml.kernel.org/r/d8e5a093-2e22-c14b-7e64-6da280398d9f@redhat.com
Link: https://lkml.kernel.org/r/20230913125113.313322-6-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 132b180)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 5a1649a commit 3af4006
1 file changed
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1233 | 1233 | | |
1234 | 1234 | | |
1235 | 1235 | | |
1236 | | - | |
| 1236 | + | |
1237 | 1237 | | |
1238 | 1238 | | |
1239 | 1239 | | |
| |||
1262 | 1262 | | |
1263 | 1263 | | |
1264 | 1264 | | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | 1265 | | |
1269 | 1266 | | |
1270 | 1267 | | |
| |||
1286 | 1283 | | |
1287 | 1284 | | |
1288 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1289 | 1290 | | |
1290 | 1291 | | |
1291 | 1292 | | |
| |||
2586 | 2587 | | |
2587 | 2588 | | |
2588 | 2589 | | |
2589 | | - | |
2590 | 2590 | | |
2591 | 2591 | | |
2592 | 2592 | | |
2593 | | - | |
2594 | | - | |
2595 | | - | |
| 2593 | + | |
2596 | 2594 | | |
2597 | 2595 | | |
| 2596 | + | |
| 2597 | + | |
2598 | 2598 | | |
2599 | 2599 | | |
2600 | 2600 | | |
| |||
0 commit comments