Commit 254ab940 authored by Peter Xu's avatar Peter Xu Committed by Linus Torvalds

mm: rename zap_skip_check_mapping() to should_zap_page()

The previous name is against the natural way people think.  Invert the
meaning and also the return value.  No functional change intended.

Link: https://lkml.kernel.org/r/20220216094810.60572-3-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
Suggested-by: default avatarDavid Hildenbrand <david@redhat.com>
Suggested-by: default avatarHugh Dickins <hughd@google.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <shy828301@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5abfd71d
...@@ -1326,20 +1326,19 @@ static inline bool should_zap_cows(struct zap_details *details) ...@@ -1326,20 +1326,19 @@ static inline bool should_zap_cows(struct zap_details *details)
/* /*
* We set details->zap_mapping when we want to unmap shared but keep private * 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 static inline bool should_zap_page(struct zap_details *details, struct page *page)
zap_skip_check_mapping(struct zap_details *details, struct page *page)
{ {
/* If we can make a decision without *page.. */ /* If we can make a decision without *page.. */
if (should_zap_cows(details)) if (should_zap_cows(details))
return false; return true;
/* E.g. the caller passes NULL for the case of a zero page */ /* E.g. the caller passes NULL for the case of a zero page */
if (!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, static unsigned long zap_pte_range(struct mmu_gather *tlb,
...@@ -1374,7 +1373,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, ...@@ -1374,7 +1373,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
struct page *page; struct page *page;
page = vm_normal_page(vma, addr, ptent); page = vm_normal_page(vma, addr, ptent);
if (unlikely(zap_skip_check_mapping(details, page))) if (unlikely(!should_zap_page(details, page)))
continue; continue;
ptent = ptep_get_and_clear_full(mm, addr, pte, ptent = ptep_get_and_clear_full(mm, addr, pte,
tlb->fullmm); tlb->fullmm);
...@@ -1408,7 +1407,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, ...@@ -1408,7 +1407,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
is_device_exclusive_entry(entry)) { is_device_exclusive_entry(entry)) {
struct page *page = pfn_swap_entry_to_page(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; continue;
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm); pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
rss[mm_counter(page)]--; rss[mm_counter(page)]--;
...@@ -1429,7 +1428,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, ...@@ -1429,7 +1428,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
struct page *page; struct page *page;
page = pfn_swap_entry_to_page(entry); page = pfn_swap_entry_to_page(entry);
if (zap_skip_check_mapping(details, page)) if (!should_zap_page(details, page))
continue; continue;
rss[mm_counter(page)]--; rss[mm_counter(page)]--;
} else if (is_hwpoison_entry(entry)) { } else if (is_hwpoison_entry(entry)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment