Received: by 10.223.164.197 with SMTP id h5csp604004wrb; Sat, 4 Nov 2017 20:03:07 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Tb3QTFAtaBhDXslFwel0bn9RSCLX9PJJi9OEOvPHBowT0HBrNlRIu2zZRvVoLEZDqE49QI X-Received: by 10.101.92.202 with SMTP id b10mr11743507pgt.164.1509850987661; Sat, 04 Nov 2017 20:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509850987; cv=none; d=google.com; s=arc-20160816; b=n4zt3MCVJlxZhs17CvpW8byqkP3nhYptX4lpUuQZcUDGF7uz1nZ9MVWSRfUT/Hiytu pe2F/oyXh8M2tJkuibXEiLbZWK+XNodEUwsRxsoxghhbr3Lgnj1EK5mttD5VgRLE82qk 9znTffhjBtg2rlr4H5Nhwb/0FdDAXboSXRQte9OzbOFgSpH0UtFj5JKhlhKCzYF4k+vr 2v4GUufLN43TKPEx6WQqitfGds97bEatJ7K82aVt1rTaHieJRMEvQ5HZHBPRF6j+I4qu kUqEy70dX0zFStGYP9TyoXqUBSoXwlPVKCs+xIRZtI9Na2xaDVeBCbgoCVcuS3a8Tk00 doTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Bdsv1PJnrIRMtBJ5Ei7RrRQx0/i0dmMHEMrGAQxQ66I=; b=uJJIFjvbPmDoOQaJ19a1b06tklVCj1H9OXpnL2bqFS5SXg0ATvRFmTEIu9atx52iTp 0COjmzcWk8PnoAYoMIjNrbS7qNPlk90phWwfpVxUAQnZNrL2ZuI8dDc0C2paa8hFOaTW 2iqxZkB2qVzxakP5I8gvTR4QtzKd5qTeYoTxPBYFHS9qSRQf4Cc2Krou8ZmtZyd1Utlg nO0OtCoOwownJeOl5Jqk1j6Nod9fD3dLKOdRGOuQNPNQXosN4VEvQycDeNxHooDk5dGW YgMfDXBhU7y/4uDBsJHokqwo5JrGYSFgSENQ4Qi1aRoyMatVQ9dsbnzM6uXA3wv6EQIi ESbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IpJQ2eSN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si8931361pgr.791.2017.11.04.20.02.53; Sat, 04 Nov 2017 20:03:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IpJQ2eSN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752531AbdKEDBI (ORCPT + 94 others); Sat, 4 Nov 2017 23:01:08 -0400 Received: from mail-qk0-f171.google.com ([209.85.220.171]:56942 "EHLO mail-qk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751613AbdKEDBH (ORCPT ); Sat, 4 Nov 2017 23:01:07 -0400 Received: by mail-qk0-f171.google.com with SMTP id l194so7368513qke.13 for ; Sat, 04 Nov 2017 20:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Bdsv1PJnrIRMtBJ5Ei7RrRQx0/i0dmMHEMrGAQxQ66I=; b=IpJQ2eSN2or0OCJfhoCKj/oD0CHWDsijARJmUzv1Gzpr0Md/OLV8A9D2+fAgJwAwi/ BSgxgK2UYZWnyq3SuFXPl4tN4yBGVuKIvDBt/47SNfdtJu2sshRKRyOdg5QJmf6+rgoV FYYqI6GxEfPbAjCJLISb2Gwa86eXc2pL3MoLCVUQcW2BbqML6yyjr4jpKnWbHtTAePIO wcCosIW+lvge53WnHVo2zy5NLqNigOTQwqvV/ZtPf4CTm7EqGnwRSbmfiuN+637zxmQe k6w0v385QbUNC5ANRF4acOvC6HF99M5hvChPWuWpNnrgSTHOm2Gx0/WO80R1HG51J4ce DApg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Bdsv1PJnrIRMtBJ5Ei7RrRQx0/i0dmMHEMrGAQxQ66I=; b=fSGnIv5UP6ywj4yPUBO2pN5AQ6l7S2RunwjVqpn7ETQtbGa85LjHsb/dXG4OP7jRHw /X7VOCf+slYe4Locph84oiMuJjg7bMgBSovHjiUuCxb+K4ah8fE7JtCVpr8dl80fU4kb 5cJIN3xsW293Cv3C6TRRlh/atx8DEPIeX/KuzsEslkBY3vyo0/nauXILyfDq5igaiSkn cnplcXtOd3IQaXsHYQ3Khb2nZtlsO/kqHXYOb7aheBg2tiGdJk0538afTP/XD4ShjzH0 jRwHaBcOz5eLXUao0znuWxSRXfd755IGjrovk93fCgxEjmzLYUdc37b4pZ9IFoCQw3OJ BKHQ== X-Gm-Message-State: AMCzsaVztFpK5M65bcmMVh7/NwNMEKczEkzqxdJx6ZzDxBqHEcAtz/kz 6AQgOFsl42ysITE+muenpWLmbJYMyyl6xnkLwzY= X-Received: by 10.233.221.66 with SMTP id r63mr16775899qkf.79.1509850866626; Sat, 04 Nov 2017 20:01:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.57.165 with HTTP; Sat, 4 Nov 2017 20:01:05 -0700 (PDT) In-Reply-To: References: <20171103075231.25416-1-ying.huang@intel.com> From: huang ying Date: Sun, 5 Nov 2017 11:01:05 +0800 Message-ID: Subject: Re: [RFC -mm] mm, userfaultfd, THP: Avoid waiting when PMD under THP migration To: Zi Yan Cc: "Huang, Ying" , Naoya Horiguchi , linux-mm@kvack.org, LKML , Andrea Arcangeli , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Alexander Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 3, 2017 at 11:00 PM, Zi Yan wrote: > On 3 Nov 2017, at 3:52, Huang, Ying wrote: > >> From: Huang Ying >> >> If THP migration is enabled, the following situation is possible, >> >> - A THP is mapped at source address >> - Migration is started to move the THP to another node >> - Page fault occurs >> - The PMD (migration entry) is copied to the destination address in mremap >> > > You mean the page fault path follows the source address and sees pmd_none() now > because mremap() clears it and remaps the page with dest address. > Otherwise, it seems not possible to get into handle_userfault(), since it is called in > pmd_none() branch inside do_huge_pmd_anonymous_page(). > > >> That is, it is possible for handle_userfault() encounter a PMD entry >> which has been handled but !pmd_present(). In the current >> implementation, we will wait for such PMD entries, which may cause >> unnecessary waiting, and potential soft lockup. > > handle_userfault() should only see pmd_none() in the situation you describe, > whereas !pmd_present() (migration entry case) should lead to > pmd_migration_entry_wait(). Yes. This is my understanding of the source code too. And I described it in the original patch description too. I just want to make sure whether it is possible that !pmd_none() and !pmd_present() for a PMD in userfaultfd_must_wait(). And, whether it is possible for us to implement PMD mapping copying in UFFDIO_COPY in the future? Best Regards, Huang, Ying > Am I missing anything here? > > > -- > Best Regards > Yan Zi From 1583057498267761827@xxx Fri Nov 03 15:01:17 +0000 2017 X-GM-THRID: 1583030690684131137 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread