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=-5.3 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 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 5CDB1C4363D for ; Tue, 22 Sep 2020 18:49:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D198020715 for ; Tue, 22 Sep 2020 18:49:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WnUY5IxV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D198020715 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 706346B005A; Tue, 22 Sep 2020 14:49:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 692CE6B005C; Tue, 22 Sep 2020 14:49:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 558F76B005D; Tue, 22 Sep 2020 14:49:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 40D756B005A for ; Tue, 22 Sep 2020 14:49:12 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 029631EF1 for ; Tue, 22 Sep 2020 18:49:12 +0000 (UTC) X-FDA: 77291584944.27.angle71_290ff7127150 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id D65453D668 for ; Tue, 22 Sep 2020 18:49:11 +0000 (UTC) X-HE-Tag: angle71_290ff7127150 X-Filterd-Recvd-Size: 5790 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 18:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600800550; 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=pvVMl2lXhY9qW3FKBTGyVnidFcK9anz/x/7S1UyT+hU=; b=WnUY5IxVnVDbAAQzJdpvzpl82RvIJNmdvLFqUw756PVMmTLAVnKtjUfZssXIyDrkOCAxnM oZVMxesFbwd5staL0OoxVhJaNToOaz7YErdCi9uZnn9PtZkKGVyY+wSbWiU0mbjDZGeCXN 6A8eBdbXURhxeDk11+TnnRHS6TIM3tI= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-B1c7J2iOOxCCa6BSf_hljA-1; Tue, 22 Sep 2020 14:49:09 -0400 X-MC-Unique: B1c7J2iOOxCCa6BSf_hljA-1 Received: by mail-qk1-f197.google.com with SMTP id m203so14453844qke.16 for ; Tue, 22 Sep 2020 11:49:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pvVMl2lXhY9qW3FKBTGyVnidFcK9anz/x/7S1UyT+hU=; b=fYwLIjaaSZSGpRkBmFELoic4KomuLvcjVvwV8/dfkISrxjtUno6uuQ6FJQovjS4j5r S+ZpArl0d2JBcHS2QT8p7NkESF+ijjYryjYZOate4CIe3sdUpSy+uSoBnhxb3aweaLDv q49VrvIiesEdCsHb56TkqLctdQYO5a+b3FP6fLOinUSmkKYpgloHytpjA8zlFZayO9sx R03MD25/EKfIvG6KeBAeucBj4CPpJ2GY48tVt1HsI7qDJo2mG6r/BgHVXxo6VTgdUAUo AJSS3vWirsHTWOoGlfpzCoHngaZb4eL5D3Av2UMTayPODzeLL1a1fRT3xH3D1cah73my 5aGw== X-Gm-Message-State: AOAM532K6h+fMtO7J1yHQQOW9r3Xfi+d2vGqMF2Z4UGDWCshJuIM2+hy RzH0WJ6xvC8bd8CqUo1s3k1h2KA7rwcRJ0cnpRLL5h58oZmxiP5Th/7ctS8h1HyxMxZMz+0NJ3J R44ANT5ln3Ec= X-Received: by 2002:a37:9a93:: with SMTP id c141mr6216704qke.203.1600800548023; Tue, 22 Sep 2020 11:49:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+gvROI+XaSQiJOWbbyz+qOZbSbM01T/V529JXEp4D7KxFRuzpRATaThLsuFBVPun4ezpFww== X-Received: by 2002:a37:9a93:: with SMTP id c141mr6216680qke.203.1600800547794; Tue, 22 Sep 2020 11:49:07 -0700 (PDT) Received: from xz-x1 (bras-vprn-toroon474qw-lp130-11-70-53-122-15.dsl.bell.ca. [70.53.122.15]) by smtp.gmail.com with ESMTPSA id f76sm11725245qke.19.2020.09.22.11.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 11:49:07 -0700 (PDT) Date: Tue, 22 Sep 2020 14:49:05 -0400 From: Peter Xu To: Oleg Nesterov 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: <20200922184905.GM19098@xz-x1> 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> <20200922182317.GH11679@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200922182317.GH11679@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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 Tue, Sep 22, 2020 at 08:23:18PM +0200, Oleg Nesterov wrote: > 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. Though I guess I'll keep my wording, because I still think it's accurate to me. :) Can we e.g. punch a page hole without changing vmas? -- Peter Xu