From patchwork Thu Feb 17 06:07:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12749420 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 B1DF8C433EF for ; Thu, 17 Feb 2022 06:08:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43AFC6B0078; Thu, 17 Feb 2022 01:08:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C2BC6B007B; Thu, 17 Feb 2022 01:08:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 215926B007D; Thu, 17 Feb 2022 01:08:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 11EA76B0078 for ; Thu, 17 Feb 2022 01:08:10 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BB38395B09 for ; Thu, 17 Feb 2022 06:08:09 +0000 (UTC) X-FDA: 79151241498.12.E08143B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 1F212100002 for ; Thu, 17 Feb 2022 06:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645078088; 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=GodqcRh1SHgqGa/hH7oS86cAqo3cWdJIC+9/AWlAQQI=; b=M31IJBEiTEwTCWXMfMLqMQn37Gi1NczmGszeqlvp9ymb5FzvDjxzyf6uMFjOg5pX3cR8nQ l+Fe3yu4nZsBnxowLCdHexyG7GpYkDESPxNZ42DSwWt5/dC4fFD0ZqEQ3pJSFzi5f5bxgA k38tX7jxhdmgB1lqJWLEoFGbAln28m8= 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-311-kDpHxoVSP5i6kmFurXc6UA-1; Thu, 17 Feb 2022 01:08:07 -0500 X-MC-Unique: kDpHxoVSP5i6kmFurXc6UA-1 Received: by mail-pj1-f72.google.com with SMTP id s10-20020a17090a948a00b001b96be201f6so2799647pjo.4 for ; Wed, 16 Feb 2022 22:08:07 -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=GodqcRh1SHgqGa/hH7oS86cAqo3cWdJIC+9/AWlAQQI=; b=LBOo+IvltM+/NAtkMzOQKyq5hswdVBAiwHKiExf++xtyQfZJw/vX0Yar9U/btDDUEC k+xZ9embEUY5/CIVaVikZAqnwLEcIOWn7VLa3GNkwqxQpkB6ABBfncPGk5XUjfTPipEo VfNuNWROEFmhnqAWvGBMkZGUFGlrr4wfaGOHt9Q8w2pa/N0yBEPy0IrDJJw152DP63iW JVClzXcZ11YoPHrc5s53Qml/1YBiJv22NLcqpg+rgQvwoQNvpIzKljRKgIh+W9ngtbze QbSnhMPfgeugOHiYuuuVXH6trHMdbPLo2eW4H8vdov2fGxjkJ57opzZlABNKbypHdcX0 TXyQ== X-Gm-Message-State: AOAM531ruVNMUQF2sVfV5OQXRHXRrSociTDeOTICXJ4fdPfo3LTGuOJI Iat4QDjMFK2OEBod8MNCY1Iq6T6brUPaLLAj5ty6VG3/CJq/SVpZ9ieHR01XO8xZuzF6ZIkZwtV JPuBRJnMMdV4DA1Yg6ydv9K5tKmiQNu1gLR1ZL+p+T23AWUrT0q7Jhyd5/i9Y X-Received: by 2002:a17:902:be0a:b0:14d:5db0:7a14 with SMTP id r10-20020a170902be0a00b0014d5db07a14mr1368624pls.155.1645078085980; Wed, 16 Feb 2022 22:08:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxmgTyql91syHq0iBmulNuYN38si4IUsKVfqHWUowF2A+HcKnj8DOPPRsO38J/B724ZyqK7Q== X-Received: by 2002:a17:902:be0a:b0:14d:5db0:7a14 with SMTP id r10-20020a170902be0a00b0014d5db07a14mr1368590pls.155.1645078085600; Wed, 16 Feb 2022 22:08:05 -0800 (PST) Received: from localhost.localdomain ([94.177.118.126]) by smtp.gmail.com with ESMTPSA id j8sm224230pjc.11.2022.02.16.22.08.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 16 Feb 2022 22:08:05 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Alistair Popple , Matthew Wilcox , peterx@redhat.com, David Hildenbrand , Andrea Arcangeli , Hugh Dickins , Yang Shi , Vlastimil Babka , John Hubbard , Andrew Morton , "Kirill A . Shutemov" Subject: [PATCH v5 2/4] mm: Rename zap_skip_check_mapping() to should_zap_page() Date: Thu, 17 Feb 2022 14:07:44 +0800 Message-Id: <20220217060746.71256-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220217060746.71256-1-peterx@redhat.com> References: <20220217060746.71256-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1F212100002 X-Stat-Signature: uonydn4rk8yrfbyj7x4sq4fa9dfez9de Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M31IJBEi; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf14.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-HE-Tag: 1645078088-559787 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 Reviewed-by: John Hubbard Signed-off-by: Peter Xu --- mm/memory.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 533da5d6c32c..3728632ea993 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. 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 @@ 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)]--; @@ -1429,7 +1428,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)) {