From patchwork Tue Mar 22 21:42:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 803C4C4332F for ; Tue, 22 Mar 2022 21:42:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16AA36B00B6; Tue, 22 Mar 2022 17:42:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F4E56B00B7; Tue, 22 Mar 2022 17:42:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFCE56B00B8; Tue, 22 Mar 2022 17:42:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id DC0626B00B6 for ; Tue, 22 Mar 2022 17:42:21 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A6C3AA4DBE for ; Tue, 22 Mar 2022 21:42:21 +0000 (UTC) X-FDA: 79273346082.22.1143CF8 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf02.hostedemail.com (Postfix) with ESMTP id 14EC080010 for ; Tue, 22 Mar 2022 21:42:20 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0AE60B81D9E; Tue, 22 Mar 2022 21:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA2AEC340EE; Tue, 22 Mar 2022 21:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985338; bh=WVtPcyz9kcIwZgZyI2+nTxY5HfwCQe0PeJBQjxrXGPU=; h=Date:To:From:In-Reply-To:Subject:From; b=JaxSM9itPcAF6XKUl12FYSRGmuPAawHyl6L6isRVmH9Y0h/KdwWt2MdOLPaD1fkv8 HouhNcXHy6NjfSE5XB3ZmCwWfigg3WClLf5XTWC2ha4uviiHvxFo8FwFXtlEn/WvYX jEK+W6RNbZBcmYY+o3vtV0rOvwVT/lJ+LTAE5W98= Date: Tue, 22 Mar 2022 14:42:18 -0700 To: willy@infradead.org,vbabka@suse.cz,shy828301@gmail.com,kirill@shutemov.name,jhubbard@nvidia.com,hughd@google.com,david@redhat.com,apopple@nvidia.com,aarcange@redhat.com,peterx@redhat.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 074/227] mm: rename zap_skip_check_mapping() to should_zap_page() Message-Id: <20220322214218.BA2AEC340EE@smtp.kernel.org> X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: co5sbghqo1g6wm6un8io768ue9zmoafb Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=JaxSM9it; dmarc=none; spf=pass (imf02.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Queue-Id: 14EC080010 X-HE-Tag: 1647985340-615072 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Peter Xu Subject: 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.com Signed-off-by: Peter Xu Suggested-by: David Hildenbrand Suggested-by: Hugh Dickins Reviewed-by: David Hildenbrand Reviewed-by: John Hubbard Cc: Alistair Popple Cc: Andrea Arcangeli Cc: "Kirill A . Shutemov" Cc: Matthew Wilcox Cc: Vlastimil Babka Cc: Yang Shi Signed-off-by: Andrew Morton --- mm/memory.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) --- a/mm/memory.c~mm-rename-zap_skip_check_mapping-to-should_zap_page +++ a/mm/memory.c @@ -1326,20 +1326,19 @@ static inline bool should_zap_cows(struc /* * 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, @@ -1374,7 +1373,7 @@ again: 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); @@ -1408,7 +1407,7 @@ again: 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)]--; @@ -1429,7 +1428,7 @@ again: 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)) {