diff options
Diffstat (limited to '')
-rw-r--r-- | mm/filemap.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 5be7887957..321349e2c9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -4150,7 +4150,23 @@ static void filemap_cachestat(struct address_space *mapping, /* shmem file - in swap cache */ swp_entry_t swp = radix_to_swp_entry(folio); + /* swapin error results in poisoned entry */ + if (non_swap_entry(swp)) + goto resched; + + /* + * Getting a swap entry from the shmem + * inode means we beat + * shmem_unuse(). rcu_read_lock() + * ensures swapoff waits for us before + * freeing the swapper space. However, + * we can race with swapping and + * invalidation, so there might not be + * a shadow in the swapcache (yet). + */ shadow = get_shadow_from_swap_cache(swp); + if (!shadow) + goto resched; } #endif if (workingset_test_recent(shadow, true, &workingset)) |