From mboxrd@z Thu Jan 1 00:00:00 1970 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 E99C8C433F5 for ; Tue, 11 Jan 2022 09:00:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 732076B0073; Tue, 11 Jan 2022 04:00:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E11A6B0074; Tue, 11 Jan 2022 04:00:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D0846B0075; Tue, 11 Jan 2022 04:00:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 4EBB06B0073 for ; Tue, 11 Jan 2022 04:00:41 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 16DC1181CAEC5 for ; Tue, 11 Jan 2022 09:00:41 +0000 (UTC) X-FDA: 79017410682.27.78A2857 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 875FC100004 for ; Tue, 11 Jan 2022 09:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641891640; 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=HwTgs2Y/gzDETqEOa6cQ15U5dH6fx+WgFTgxP975v6Q=; b=gDWrQeambq5xOYRRcHZNcVV9tG/csQBBwflMuRO+ZDBZb/+Z/4klSdBM0PscdwRqclY9jG ZCuUHM8hsi4G48q3+q/0qIQ21JtxL5ghQZ3BRF765jxGQJQ4AlfYYTjE7f++U/mQemH2xM rHTBXOD2azT4myq4uCd1C5gRjwxGWkQ= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-618-4QD0WhEAPjWwkAlWnL1Wzg-1; Tue, 11 Jan 2022 04:00:38 -0500 X-MC-Unique: 4QD0WhEAPjWwkAlWnL1Wzg-1 Received: by mail-ed1-f69.google.com with SMTP id z8-20020a056402274800b003f8580bfb99so12696517edd.11 for ; Tue, 11 Jan 2022 01:00:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=HwTgs2Y/gzDETqEOa6cQ15U5dH6fx+WgFTgxP975v6Q=; b=5iy4xgEqrztTWkAxFA18w5TGDOCYXr/e8tgsuekZLzrkK2y5+DygTxRDbnba8o74/D 9fEDZR6q6J93TopUjVFfahZp1+uD7zFMLnCL73p4QTAqDTBDf6lZhmQdOvdRbzhjSbOk LNq7o0Fxm3AAjKAIM4DsFTwBBLg2RwJvtXzE+wTCf8h8jeVvyemu7p+/69i47cjUwFOj Voss4Gh73KTBUeGgNLrJtm45JR67UXOa3ZfsjEtdK0OJK0NIGCB8MQaAIQpA3qouFZ+F NehMNo//1MyPWFyt4ZXa1ZfUjqMgHPCP8MoJOc0AZ++cHSdJg4Jp6bntjFxUGIvnWEdC VFjA== X-Gm-Message-State: AOAM533lgLDRNdZ9v5LXobCWueesWj79rYhSvcBnzQWlvoMwrNwSVI88 Ss+I9QsrkU8U/70C55ZFHgf08OeXDuFDez2xdDZQGbnVA27pe/Wi0lQDWRh9qzrAAHbutgqXUF/ rEJNsI+Wbgrk= X-Received: by 2002:aa7:db90:: with SMTP id u16mr3397374edt.403.1641891637586; Tue, 11 Jan 2022 01:00:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyt1tzZWdcTIPjqZ/ckY27ze6jZWXnU+i9Or1hNPoXVzyiDFui8mVzHKOKlX5UJaksDRC7jqg== X-Received: by 2002:aa7:db90:: with SMTP id u16mr3397346edt.403.1641891637307; Tue, 11 Jan 2022 01:00:37 -0800 (PST) Received: from ?IPV6:2003:cb:c702:6800:150a:bea9:f03e:c4da? (p200300cbc7026800150abea9f03ec4da.dip0.t-ipconnect.de. [2003:cb:c702:6800:150a:bea9:f03e:c4da]) by smtp.gmail.com with ESMTPSA id h11sm4815589edb.59.2022.01.11.01.00.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jan 2022 01:00:36 -0800 (PST) Message-ID: <865621ac-81e4-5396-ded1-3502b1e5a061@redhat.com> Date: Tue, 11 Jan 2022 10:00:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 To: Alistair Popple , Peter Xu , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrea Arcangeli , Yang Shi , Vlastimil Babka , Hugh Dickins , Andrew Morton , "Kirill A . Shutemov" References: <20211115134951.85286-1-peterx@redhat.com> <20211115134951.85286-2-peterx@redhat.com> <849f1e44-d35e-b8c6-c7c3-a73941028ba7@redhat.com> <4711362.BPgp0156Pq@nvdebian> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH RFC v2 1/2] mm: Don't skip swap entry even if zap_details specified In-Reply-To: <4711362.BPgp0156Pq@nvdebian> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 875FC100004 X-Stat-Signature: schgezkfqgpyb5du6n63rwsm4zs8pxfq Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gDWrQeam; spf=none (imf14.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam07 X-HE-Tag: 1641891640-977832 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: On 11.01.22 08:40, Alistair Popple wrote: > On Monday, 10 January 2022 7:37:15 PM AEDT David Hildenbrand wrote: >> On 15.11.21 14:49, Peter Xu wrote: >>> This check existed since the 1st git commit of Linux repository, but at that >>> time there's no page migration yet so I think it's okay. >>> >>> With page migration enabled, it should logically be possible that we zap some >>> shmem pages during migration. When that happens, IIUC the old code could have >>> the RSS counter accounted wrong on MM_SHMEMPAGES because we will zap the ptes >>> without decreasing the counters for the migrating entries. I have no unit test >>> to prove it as I don't know an easy way to trigger this condition, though. >>> >>> Besides, the optimization itself is already confusing IMHO to me in a few points: >>> >>> - The wording "skip swap entries" is confusing, because we're not skipping all >>> swap entries - we handle device private/exclusive pages before that. >> >> I think one part of the confusion is "swap vs non-swap" entries. >> For !pte_none() && !pte_present() we can have >> >> * swap entry >> * non-swap entry >> ** device exclusive entry >> ** device private entry >> ** HWpoison entry >> ** migration entry >> >> So the comment claims to skip "swap entries" but also skips HWpoison and >> migration entries, and I think that's the confusing part. >> Both only apply to PageAnon(). > > I must be missing something but why do these only apply to PageAnon()? My memory might be wrong. I remember that for PageAnon() we need migration/hwpoison entries because there is no way we could refault the page from a mapping once we zap the entry. For everything else, we could zap and refault. But looks like we indeed also use migration/hwpoison entries for pages with a mapping, although it might not be strictly required. > >> IIUC, the only way we could get details != NULL is via unmap_mapping_page()+unmap_mapping_pages(). >> >> I do wonder if any of the callers really cares about PageAnon() pages where this would be relevant. >> >> Am I wrong or is unmap_mapping_pages() never called with "even_cows == true" and we can remove >> that paremeter: > > Except that unmap_mapping_range() takes `even_cows` as a parameter and passes > that to unmap_mapping_pages(), and from what I can tell there are callers of > unmap_mapping_range() that set `even_cows = true`. You're right. -- Thanks, David / dhildenb