From patchwork Fri Jan 28 04:54:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12727934 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 60B6AC433F5 for ; Fri, 28 Jan 2022 04:54:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C14DA6B0092; Thu, 27 Jan 2022 23:54:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCF2F6B0093; Thu, 27 Jan 2022 23:54:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3FB46B0095; Thu, 27 Jan 2022 23:54:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 92E036B0092 for ; Thu, 27 Jan 2022 23:54:38 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4F44695260 for ; Fri, 28 Jan 2022 04:54:38 +0000 (UTC) X-FDA: 79078480236.04.206B14F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id CE92440014 for ; Fri, 28 Jan 2022 04:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643345677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X4WXHh7pV56dMHSpF/O5K7LVTClsvKIQ79sBisfSRRA=; b=NwLxpM3xsdpQRDDPRuXsKZsvIwme0k4TWM+FtVyDrXervUyNetKC5XrrKb3DP0MP11WjOc 5CjN0BKwYpEQ2zUMblNGedazIW8hhBl0JL0ddU30EkGy3Bh77qYhdWy60IdolzfUanV2v7 nWW8/qLgNScGCEe+kaeucWEd/SrN/sk= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-arKQiqOjONy13JKnoPSofA-1; Thu, 27 Jan 2022 23:54:36 -0500 X-MC-Unique: arKQiqOjONy13JKnoPSofA-1 Received: by mail-wr1-f70.google.com with SMTP id k7-20020adfb347000000b001dd761d46c7so92131wrd.4 for ; Thu, 27 Jan 2022 20:54:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X4WXHh7pV56dMHSpF/O5K7LVTClsvKIQ79sBisfSRRA=; b=dJIbfc8LK7dpOI8pGov5SekNHG3/Z9GEQvWub+w1setarzFYJ/tlACd5NV7d9GMRH5 DhszqHJIop0mQUVYrs4cEU/x80Bheiur/XJXKoccvAkT7eibDKr7yA1h4YeLIjJoJYN7 x8iuQoGo7n1x9hkBLLA8rfqfU8EhPt2exmU3yhR7HCHeRTa8tGamnUcPqagWa87TDzQH M1nx4mj86EPaQ4WqjKZgODUWL1LVE9j85oK5PxECpejLSP0BEO7GCdxQq8rLmFlnGCST /QC2uvtNdvz82ytUiFd7lLnVcHDqlz5rlM8F2Msaj4LRUmVwBiTleYyoqwKLIU7COH6f tlNQ== X-Gm-Message-State: AOAM530B6YCVJzuy/TvOBEszvJT+LeABZAMzllshTO7Xn8KwJ2muTFj+ +e8R1IjAqH+oqAfxqMuewwE6oUum0/u0frr57I5leFFUc8dJZkzv+w9saWHFeRlSZ2kUnaAKSP1 +E04D6yT7n2IZo33C8XLWNAhYuPmwPi7o81Fd0TjkqmDEqHIDTrh5lhqmRxsk X-Received: by 2002:a1c:a90d:: with SMTP id s13mr5787863wme.32.1643345674676; Thu, 27 Jan 2022 20:54:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUZOPum7MMLETcw25d/iBx+n7SScJ596aZWjbvcjraz7IAo8lenVlYxR/jtIOkJT4M5mmwpg== X-Received: by 2002:a1c:a90d:: with SMTP id s13mr5787840wme.32.1643345674342; Thu, 27 Jan 2022 20:54:34 -0800 (PST) Received: from localhost.localdomain ([64.64.123.9]) by smtp.gmail.com with ESMTPSA id i13sm814014wrf.3.2022.01.27.20.54.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jan 2022 20:54:34 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Alistair Popple , Andrew Morton , Andrea Arcangeli , David Hildenbrand , Matthew Wilcox , John Hubbard , Hugh Dickins , Vlastimil Babka , Yang Shi , "Kirill A . Shutemov" Subject: [PATCH v3 2/4] mm: Rename zap_skip_check_mapping() to should_zap_page() Date: Fri, 28 Jan 2022 12:54:10 +0800 Message-Id: <20220128045412.18695-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220128045412.18695-1-peterx@redhat.com> References: <20220128045412.18695-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: nil X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: CE92440014 X-Stat-Signature: qdxkg3eda366wgmbcc1xz4o5u7acn8a8 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NwLxpM3x; spf=none (imf04.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1643345677-657828 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: The previous name is against the natural way people think. Invert the meaning and also the return value. No functional change intended. Suggested-by: Hugh Dickins Signed-off-by: Peter Xu Reviewed-by: David Hildenbrand --- mm/memory.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 4bfeaca7cbc7..14d8428ff4db 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -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 - * 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. 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 @@ 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); @@ -1408,7 +1407,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, 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)]--; @@ -1433,7 +1432,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, 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)) {