From patchwork Wed Feb 16 09:48:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12748345 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 8C237C433F5 for ; Wed, 16 Feb 2022 09:49:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D1596B007D; Wed, 16 Feb 2022 04:49:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1800F6B007E; Wed, 16 Feb 2022 04:49:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0490E6B0080; Wed, 16 Feb 2022 04:49:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id E9B096B007D for ; Wed, 16 Feb 2022 04:49:06 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A9B389276E for ; Wed, 16 Feb 2022 09:49:06 +0000 (UTC) X-FDA: 79148169492.18.43E81F6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 26F5F1C0002 for ; Wed, 16 Feb 2022 09:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645004945; 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=trYMhQgsw7O8qP2aA5tHFBOoRzKbhngS39UuP85axlI=; b=Uv6trUpjNpmXncbfkASgd01XuxLuEvrZ8X/Klngc0fesEmnkEbB24+3NjGYSkc8ULuVxqn +YmNHZ8pEfgIj221l83hO56Ysnf7Q01HLhq+bYSqbHTJWHzguxHTN2wI/orsazHSNrYhOX oLQQ/QRqxrvdizxPjWezjgP4Qckf9kw= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-241-WCcDg_R2Oy2CqrQFJaghlQ-1; Wed, 16 Feb 2022 04:49:04 -0500 X-MC-Unique: WCcDg_R2Oy2CqrQFJaghlQ-1 Received: by mail-pj1-f72.google.com with SMTP id b9-20020a17090aa58900b001b8b14b4aabso1183704pjq.9 for ; Wed, 16 Feb 2022 01:49:04 -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=trYMhQgsw7O8qP2aA5tHFBOoRzKbhngS39UuP85axlI=; b=WVKMO1l8b/+sy8/+IxLcWaD3tnwBeX+P91KMHMqoIhFE8QnuMp5Yjq73I4UMUbwAw2 Il0yqyeY2R8KAS6H2ttV2T/Jp4Vetv0p0b4hj2H+HED42cjdqIX4PPCyBifeEMP7E3yK IOib/uipxlnzk1CL8VdiRqiTghNXW/3oByQJyYhqKqOBUXi64S1qU+K7c3mgidPyrzwW sLAqFOSbxSLmouvfRLM6rmUIV1NKvmI9FDRYK43hFeNYfFgf01mEXnqs6DFmQyaD0Kgd 06IS6vnwKotZmuEWLporeIAh9tNodAPsPeS702UFJfXAVug2y7W2wZ6EXUVX+DgNQuDv acXw== X-Gm-Message-State: AOAM530w8HTMaQg9H12oLhkGrENa3riVaIed48zYXJWrikFr5KbY4fEm My9hqPRNNVOnLaWLcxyGU7bIlciVEGWeawtM57pflFc2LHbJskHCFbhqQKaIZbsRFn/8asYHZMI Wt4NYraRyfBA= X-Received: by 2002:a17:903:228a:b0:14d:aa04:2278 with SMTP id b10-20020a170903228a00b0014daa042278mr1850392plh.58.1645004943456; Wed, 16 Feb 2022 01:49:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwp9Rn/eyC2VMT306FaqLkb/8rUoQRaxAT2awvvDCzl/7i40J6BsqMQKml7qFHRkaY20DhzAA== X-Received: by 2002:a17:903:228a:b0:14d:aa04:2278 with SMTP id b10-20020a170903228a00b0014daa042278mr1850363plh.58.1645004943140; Wed, 16 Feb 2022 01:49:03 -0800 (PST) Received: from localhost.localdomain ([64.64.123.81]) by smtp.gmail.com with ESMTPSA id qe7sm11567835pjb.25.2022.02.16.01.48.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 16 Feb 2022 01:49:02 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , "Kirill A . Shutemov" , Matthew Wilcox , Yang Shi , Andrea Arcangeli , peterx@redhat.com, John Hubbard , Alistair Popple , David Hildenbrand , Vlastimil Babka , Hugh Dickins Subject: [PATCH v4 2/4] mm: Rename zap_skip_check_mapping() to should_zap_page() Date: Wed, 16 Feb 2022 17:48:08 +0800 Message-Id: <20220216094810.60572-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220216094810.60572-1-peterx@redhat.com> References: <20220216094810.60572-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: i7m46tq7fy4bk4r43f4637qmq4qdpoys X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 26F5F1C0002 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Uv6trUpj; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf20.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-HE-Tag: 1645004945-330094 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: David Hildenbrand Suggested-by: Hugh Dickins Reviewed-by: David Hildenbrand Signed-off-by: Peter Xu Reviewed-by: John Hubbard --- 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)) {