mirror of
https://github.com/torvalds/linux.git
synced 2024-12-24 20:01:55 +00:00
mm/madvise: free hwpoison and swapin error entry in madvise_free_pte_range
Once the MADV_FREE operation has succeeded, callers can expect they might get zero-fill pages if accessing the memory again. Therefore it should be safe to delete the hwpoison entry and swapin error entry. There is no reason to kill the process if it has called MADV_FREE on the range. Link: https://lkml.kernel.org/r/20220519125030.21486-4-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Suggested-by: Alistair Popple <apopple@nvidia.com> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com> Cc: David Howells <dhowells@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: NeilBrown <neilb@suse.de> Cc: Peter Xu <peterx@redhat.com> Cc: Ralph Campbell <rcampbell@nvidia.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
14a762dd19
commit
7b49514fa1
@ -624,11 +624,14 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
|
||||
swp_entry_t entry;
|
||||
|
||||
entry = pte_to_swp_entry(ptent);
|
||||
if (non_swap_entry(entry))
|
||||
continue;
|
||||
if (!non_swap_entry(entry)) {
|
||||
nr_swap--;
|
||||
free_swap_and_cache(entry);
|
||||
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
|
||||
} else if (is_hwpoison_entry(entry) ||
|
||||
is_swapin_error_entry(entry)) {
|
||||
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user