Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4617617imm; Tue, 11 Sep 2018 15:03:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZCNuTHw5WikwF8uZ2UpSEsbhhC/cEaMk650N/MedCq9+CSCKhw+vBMatwtqh6A8+MVE3UW X-Received: by 2002:a63:4d21:: with SMTP id a33-v6mr30522311pgb.408.1536703387097; Tue, 11 Sep 2018 15:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536703387; cv=none; d=google.com; s=arc-20160816; b=qg7ZuioY+oMYkA/P4MaKqaAl37aKZxWNs5HZgm3iBGpnK5bE5JYDeYWSbMjidcU1bE Cpd9jYrer7swwrniVMKHdZqqrusDvgnZ6G26MjiBz+EcdzrK4/jFKxk7ztRZqve6WmOt ZaaFZoBiKUpeFnYHQBMTHThBKEPWQykgW/kKXUf7R1DECpqX1TqiBnIpsXTzrkDUHRBr m7M7Ja7WnuKwrCvdc7hI6zE+xUkpq2fE/xCK6Vq2/nftj66B0RcC2CV+lRDZmqYtLiJJ NU/qMHamYtjxCD9ZJku1ieQkOIZmAwaT4hhrnl7bcRaT3XS6w8PdJqYCF3+aIAOLCP6l LLDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vUCwlipNH6jpAiwMw98CZTcPDwJ18v87fAZjPliKZQM=; b=CWHNQd75Sf1ygitxdWbBJ0wC52gZsS29u5DNkn6TiIO8BP49k6hzeo+b6CFMNwhWvq 2l3KnHa39qVxHKnIiuvW8j0XXNhdv3uH21xrU+T3yYXBqO63hnfZtUvaEAS3x7U1LqVu YuNCP0bs9HD1cR7HIG2y/W0qDk66oa2+WsTNnvMG2hIRf2J8zpmiCa5DikBBVyShySae V52AX3BncYLZPVtm6u1Lk5BulqaKjG/XCeF8R972fDbqS7RlX9HxXjZPt/R9mFcD3dIa lHnuNWvr0VE3Ow1YolIoK4Ka6a768O7mWohCkk/OcJVTRqP3Oz7nprhc0qGo/2Om6Dnf 2Xzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="VG7R2/6Y"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11-v6si23366533pfc.38.2018.09.11.15.02.52; Tue, 11 Sep 2018 15: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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="VG7R2/6Y"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbeILDDr (ORCPT + 99 others); Tue, 11 Sep 2018 23:03:47 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40894 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbeILDDr (ORCPT ); Tue, 11 Sep 2018 23:03:47 -0400 Received: by mail-pg1-f194.google.com with SMTP id l63-v6so12923843pga.7 for ; Tue, 11 Sep 2018 15:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vUCwlipNH6jpAiwMw98CZTcPDwJ18v87fAZjPliKZQM=; b=VG7R2/6YIeI7SmVi0WaymMPDT/UgmFAwUacJNlKHn/YFw44OKV/okXEMBTAyA8XHgs GbFdx/W43u+jsZLN3B+T9GG0SNKgsd116Kxz+vc4QsQyQtn6BqfKciQAu142XZhXmXAf sb+MYUeokGM2ui4vqi8Zp3l8HKujH9ijVK8xgfPmAzRkovJaHnxWa52ePSZ2UgvXOZ3s tDFa1deC4R1xkq2pYEHZbRfxccYy1P5VgquMqkZGx2kH5HYlXmP3htZAOE9KZMpwkWW7 fHm7/9rupjLlqnMzWmlD4VdQbbAzszEY+fh6+fo8rwUJtaPW2Skk+c8/86wJHQG5bi6f QG+Q== 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:user-agent; bh=vUCwlipNH6jpAiwMw98CZTcPDwJ18v87fAZjPliKZQM=; b=d88FAJVZ5rZAXoTd1WfDqkuYyRLxZq4R1fRMRTKpR7ZnGnp2ZHb2dYUouwIaldlNKV wQ/IpBFXJ3r9VyUdX6VAcaIi+o8zc8y5kGxNNz2sGxCBXx8/1/fPiUeplHl6hJbXbTxf BsOcFQYxIiXMEdKYJ4bg8cg05oImRaKH6AFls+ymG/XVhsNta9kN9xTZ8mL7Xy+XyWyX 3K/WtkXIq367YjFeSB71BVLN2waV9dX7KjeBpQfKBl4hHRJqas3laabwjmxIVnMahagA PLPmvfJ2/VppScTuHn8fwprgIyPT29MB3oS5BDvHklxEZq5BexwkzMTmwzmpZIEV1OO6 yAIQ== X-Gm-Message-State: APzg51CqFG+FK1b0MQQFjHJonTHXf0Fa21Ajpncevg8J6H4DTKaxVL8e xC2XSeS8Y6vIFIaheqZZYY7V7A== X-Received: by 2002:a65:608b:: with SMTP id t11-v6mr30900939pgu.259.1536703347394; Tue, 11 Sep 2018 15:02:27 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([134.134.139.83]) by smtp.gmail.com with ESMTPSA id r23-v6sm40307024pfj.5.2018.09.11.15.02.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 15:02:24 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 08553300DB6; Wed, 12 Sep 2018 01:02:20 +0300 (+03) Date: Wed, 12 Sep 2018 01:02:19 +0300 From: "Kirill A. Shutemov" To: Zi Yan Cc: "Kirill A. Shutemov" , Andrew Morton , Vegard Nossum , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Naoya Horiguchi , Vlastimil Babka , Andrea Arcangeli Subject: Re: [PATCH] mm, thp: Fix mlocking THP page with migration enabled Message-ID: <20180911220219.y6qahrzgkf3ut23d@kshutemo-mobl1> References: <20180911103403.38086-1-kirill.shutemov@linux.intel.com> <5E196C27-3D56-4D76-B361-0665CB3790BF@cs.rutgers.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5E196C27-3D56-4D76-B361-0665CB3790BF@cs.rutgers.edu> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 11, 2018 at 04:30:02PM -0400, Zi Yan wrote: > I want to understand the Anon THP part of the problem more clearly. For Anon THPs, > you said, PTEs for the page will always come after mlocked PMD. I just wonder that if > a process forks a child1 which forks its own child2 and the child1 mlocks a subpage causing > split_pmd_page() and migrates its PTE-mapped THP, will the kernel see the sequence of PMD-mapped THP, > PTE-mapped THP, and PMD-mapped THP while walking VMAs? Will the second PMD-mapped THP > reset the mlock on the page? VM_LOCKED is not inheritable. child2 will not have the VMA mlocked and will not try to mlock the page. If child2 will do mlock() manually it will cause CoW and the process will ge new pages in the new VMA. > In addition, I also discover that PageDoubleMap is not set for double mapped Anon THPs after migration, > the following patch fixes it. Do you want me to send it separately or you can merge it > with your patch? I think we can live without DoubleMap for anon-THP: rmap walking order semantics and the fact that page can be shared only over fork() should be enough to get it under control. DoubleMap comes with overhead and I would like to avoid it where possible. -- Kirill A. Shutemov