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 8A0A4C433EF for ; Wed, 20 Apr 2022 07:07:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B8B66B0072; Wed, 20 Apr 2022 03:07:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01A296B0073; Wed, 20 Apr 2022 03:07:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD5526B0074; Wed, 20 Apr 2022 03:07:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id C87C26B0072 for ; Wed, 20 Apr 2022 03:07:55 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 70CD461217 for ; Wed, 20 Apr 2022 07:07:55 +0000 (UTC) X-FDA: 79376377710.25.3F3B007 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 235AB40002 for ; Wed, 20 Apr 2022 07:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650438474; 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=53ZSQ8DZrgfSyEjP1HZalPjAdZsv4fTD0UcvmrFu4rs=; b=FRCaRs+oGVBRBSVqoMVYZ2keFDhosialc27Cu2zFsaYA11sIeOTWZlvNrzCNwBO0fsDjTL WToE2kHXP889LeqECXGVNqlHQUzBpKx7O/N+3iNkfJROkkOXAbylFsU/uBX0avI+5l0G3K 16jXPqxoJzD25iPNBpcAyU6XFXzJhQ4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-wPsYNuY-NtKBF2VlWmhMuQ-1; Wed, 20 Apr 2022 03:07:50 -0400 X-MC-Unique: wPsYNuY-NtKBF2VlWmhMuQ-1 Received: by mail-wm1-f69.google.com with SMTP id bg8-20020a05600c3c8800b0038e6a989925so534691wmb.3 for ; Wed, 20 Apr 2022 00:07:50 -0700 (PDT) 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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=53ZSQ8DZrgfSyEjP1HZalPjAdZsv4fTD0UcvmrFu4rs=; b=ylul6Nu4fsRQ1kJIGkMZzhRrmQpHiZhc/wfeiGxYvoUiEjC7CbtcuLhyE1uWF36eBp qAbainkJjldkD3uYUfqlnotGMz/j6WwQsKRPZSdkqHqoAauK3xVIWir4dhIRm/iMkRzb S6NXmw4cbhYShDWFRk3NUx9ZLwVMQ9m4vr+h3ACfyDCyJxLi88b7JJ/OPnFd8ryEGFNG NHD1UVou8zgwlSynUxTNTjxHJNfA7ZLphMvAAnQREXNVskFtrwFJOXKyHxvErqqiqDou IsulI8aJDASgTiOIBtz4c4KlolRj1rrqXwXUyACG8FiJPbknzHJ2eqO7U2gp+/s2Hb/F naBA== X-Gm-Message-State: AOAM532J4CAkhILySX1C/cilY6cg2KoOpGiOA/Ini69WUT5OelF7Ovte SdR9tyQi5ZbRVqcUmCaOLrLWMXkh6jbR+eaR2k3fvP4HhPYJeHIO/k2yo4V37nxjs7wMA14TCE+ tw7n4N7NFTvw= X-Received: by 2002:a05:600c:a03:b0:38c:f953:ae13 with SMTP id z3-20020a05600c0a0300b0038cf953ae13mr2130076wmp.99.1650438469637; Wed, 20 Apr 2022 00:07:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX+/xB8hJ1qyU9HGOjEiJmQi7PnVrCP/c7OX8ZAJZ3EXklbNcIWsUJ1NOyQ8fESFa6nJBcGA== X-Received: by 2002:a05:600c:a03:b0:38c:f953:ae13 with SMTP id z3-20020a05600c0a0300b0038cf953ae13mr2130051wmp.99.1650438469286; Wed, 20 Apr 2022 00:07:49 -0700 (PDT) Received: from ?IPV6:2003:cb:c702:3d00:23e4:4c84:67a5:3ccf? (p200300cbc7023d0023e44c8467a53ccf.dip0.t-ipconnect.de. [2003:cb:c702:3d00:23e4:4c84:67a5:3ccf]) by smtp.gmail.com with ESMTPSA id v11-20020adfa1cb000000b0020ab21e1e61sm274196wrv.51.2022.04.20.00.07.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Apr 2022 00:07:48 -0700 (PDT) Message-ID: Date: Wed, 20 Apr 2022 09:07:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v2] mm/swapfile: unuse_pte can map random data if swap read fails To: Miaohe Lin , Alistair Popple Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, neilb@suse.de, surenb@google.com, minchan@kernel.org, peterx@redhat.com, sfr@canb.auug.org.au, rcampbell@nvidia.com, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220416030549.60559-1-linmiaohe@huawei.com> <87tuapk9n7.fsf@nvdebian.thelocal> <87r15tjy76.fsf@nvdebian.thelocal> <87k0bkk2rp.fsf@nvdebian.thelocal> <6cf3726c-d6d0-4255-2deb-3688227c633e@huawei.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <6cf3726c-d6d0-4255-2deb-3688227c633e@huawei.com> 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 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FRCaRs+o; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf11.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 235AB40002 X-Stat-Signature: 3jcbco3k9dh86tgm6rkc3x385af9c6ib X-HE-Tag: 1650438472-33200 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 20.04.22 08:15, Miaohe Lin wrote: > On 2022/4/20 8:25, Alistair Popple wrote: >> Miaohe Lin writes: >> >>> On 2022/4/19 15:53, Alistair Popple wrote: >>>> Also in madvise_free_pte_range() you could just remove the swap entry as it's no >>>> longer needed. >>>> >>> >>> This swap entry will be removed in madvise_dontneed_single_vma(). >>> And in madvise_free_pte_range(), we may need to keep it as same as >>> hwpoison entry. Or am I supposed to remove it even if hwpoison entry >>> is reused later? >> >> Why would we need to keep it for MADV_FREE though? It only works on private >> anonymous memory, and once the MADV_FREE operation has succeeded callers can >> expect they might get zero-fill pages if accessing the memory again. Therefore >> it should be safe to delete the entry. I think that applies equally to a >> hwpoison entry too - there's no reason to kill the process if it has called >> MADV_FREE on the range. > > I tend to agree. We can drop the swapin error entry and hwpoison entry when MADV_FREE > is called. Should I squash these into the current patch or a separate one is preferred? > That should go into a separate patch. -- Thanks, David / dhildenb