ANDROID: mm: madvise: Avoid counting swap entry references for migration entries

Race between the madvise(PAGEOUT) and migration caused by page offline
can make the swp_swapcount()->_swap_info_get emitting the "Bad swap file
entry " message because it is trying to get the info on the migration
entry. Add check if it is a migration entry.

Bug: 356032508
Fixes: aee36dd530 ("ANDROID: mm: add vendor hooks in madvise for swap entry")
Change-Id: Ia209d2a0103ac506ceae8fd71f733c1dc85443a6
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Signed-off-by: Nikhil V <quic_nprakash@quicinc.com>
This commit is contained in:
Charan Teja Kalla
2024-07-24 22:37:01 +05:30
committed by Nikhil V
parent 7fa70ede91
commit 7d0a1d6b86

View File

@@ -450,7 +450,8 @@ regular_page:
if (!pte_present(ptent)) {
entry = pte_to_swp_entry(ptent);
trace_android_vh_madvise_pageout_swap_entry(entry,
if (!is_migration_entry(entry))
trace_android_vh_madvise_pageout_swap_entry(entry,
swp_swapcount(entry));
continue;
}