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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37547C2D0E2 for ; Tue, 22 Sep 2020 18:23:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 90EFF239D2 for ; Tue, 22 Sep 2020 18:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="G2u1aaCD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90EFF239D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0E1026B0037; Tue, 22 Sep 2020 14:23:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 092026B0055; Tue, 22 Sep 2020 14:23:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9B846B005A; Tue, 22 Sep 2020 14:23:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id D3F846B0037 for ; Tue, 22 Sep 2020 14:23:33 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 88DF78249980 for ; Tue, 22 Sep 2020 18:23:33 +0000 (UTC) X-FDA: 77291520306.25.mask32_1c133f82714f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 653A41804E3A0 for ; Tue, 22 Sep 2020 18:23:33 +0000 (UTC) X-HE-Tag: mask32_1c133f82714f X-Filterd-Recvd-Size: 4272 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 18:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600799012; 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: in-reply-to:in-reply-to:references:references; bh=ovmZrpAC+T2YMt44GFu5rQZOQ7iR8zuXRD3rJJbHavM=; b=G2u1aaCDVqPT+rOdvLs4bynXsJHwX2mlsbSgbHOXf5OyHtqvJQII8KnqMPMEQNWp5eB8vA tGzEu3b3tX+jOlRIVqroLTwgWUF5pq3Ac1Er3T5H0t7BeE+NawH4AHDrNao1kSJPuN9MoQ PE2wcCh3ctTFkC6Fe8sMgbjtNxFn0ng= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-DIMrhNbONEK1AjdJmpafsw-1; Tue, 22 Sep 2020 14:23:28 -0400 X-MC-Unique: DIMrhNbONEK1AjdJmpafsw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DA31801ABB; Tue, 22 Sep 2020 18:23:26 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.146]) by smtp.corp.redhat.com (Postfix) with SMTP id 9CAF45DE19; Tue, 22 Sep 2020 18:23:19 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 22 Sep 2020 20:23:26 +0200 (CEST) Date: Tue, 22 Sep 2020 20:23:18 +0200 From: Oleg Nesterov To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jason Gunthorpe , Andrew Morton , Jan Kara , Michal Hocko , Kirill Tkhai , Kirill Shutemov , Hugh Dickins , Christoph Hellwig , Andrea Arcangeli , John Hubbard , Leon Romanovsky , Linus Torvalds , Jann Horn Subject: Re: [PATCH 3/5] mm: Rework return value for copy_one_pte() Message-ID: <20200922182317.GH11679@redhat.com> References: <20200921211744.24758-1-peterx@redhat.com> <20200921211744.24758-4-peterx@redhat.com> <20200922100840.GA11679@redhat.com> <20200922101815.GB11679@redhat.com> <20200922153612.GF19098@xz-x1> <20200922154845.GE11679@redhat.com> <20200922160330.GH19098@xz-x1> <20200922165354.GG11679@redhat.com> <20200922181306.GJ19098@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922181306.GJ19098@xz-x1> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 09/22, Peter Xu wrote: > > On Tue, Sep 22, 2020 at 06:53:55PM +0200, Oleg Nesterov wrote: > > On 09/22, Peter Xu wrote: > > > > > > On Tue, Sep 22, 2020 at 05:48:46PM +0200, Oleg Nesterov wrote: > > > > > However since I didn't change this logic in this patch, it probably means this > > > > > bug is also in the original code before this series... I'm thinking maybe I > > > > > should prepare a standalone patch to clear the swp_entry_t and cc stable. > > > > > > > > Well, if copy_one_pte(src_pte) hits a swap entry and returns entry.val != 0, then > > > > pte_none(*src_pte) is not possible after restart? This means that copy_one_pte() > > > > will be called at least once. > > > > > > Note that we've released the page table locks, so afaict the old swp entry can > > > be gone under us when we go back to the "do" loop... :) > > > > But how? > > > > I am just curious, I don't understand this code enough. > > Me neither. > > The point is I think we can't assume *src_pte will read the same if we have > released the src_ptl in copy_pte_range(), This is clear. But I still think that !pte_none() -> pte_none() transition is not possible under mmap_write_lock()... OK, let me repeat I don't understans these code paths enough, let me reword: I don't see how this transition is possible. Oleg.