/*
* We set details->zap_mapping when we want to unmap shared but keep private
- * pages. Return true if skip zapping this page, false otherwise.
+ * pages. Return true if we should zap this page, false otherwise.
*/
-static inline bool
-zap_skip_check_mapping(struct zap_details *details, struct page *page)
+static inline bool should_zap_page(struct zap_details *details, struct page *page)
{
/* If we can make a decision without *page.. */
if (should_zap_cows(details))
- return false;
+ return true;
/* E.g. the caller passes NULL for the case of a zero page */
if (!page)
- return false;
+ return true;
- return details->zap_mapping != page_rmapping(page);
+ return details->zap_mapping == page_rmapping(page);
}
static unsigned long zap_pte_range(struct mmu_gather *tlb,
struct page *page;
page = vm_normal_page(vma, addr, ptent);
- if (unlikely(zap_skip_check_mapping(details, page)))
+ if (unlikely(!should_zap_page(details, page)))
continue;
ptent = ptep_get_and_clear_full(mm, addr, pte,
tlb->fullmm);
is_device_exclusive_entry(entry)) {
struct page *page = pfn_swap_entry_to_page(entry);
- if (unlikely(zap_skip_check_mapping(details, page)))
+ if (unlikely(!should_zap_page(details, page)))
continue;
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
rss[mm_counter(page)]--;
struct page *page;
page = pfn_swap_entry_to_page(entry);
- if (zap_skip_check_mapping(details, page))
+ if (!should_zap_page(details, page))
continue;
rss[mm_counter(page)]--;
} else if (is_hwpoison_entry(entry)) {