Received: by 10.192.165.148 with SMTP id m20csp4907987imm; Tue, 1 May 2018 06:05:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrwKyqN8h2oKhzqQLw+OwvuVclt0yVzQ/P+W+0XRXMzKPJ19GPpcJYAFI7+wYcIFTZjDxWi X-Received: by 2002:a17:902:b184:: with SMTP id s4-v6mr8671173plr.359.1525179931457; Tue, 01 May 2018 06:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525179931; cv=none; d=google.com; s=arc-20160816; b=h/qOIlm6GNml9gm1Y+Jr5qbpnF2PB7Larr4IbfUfbeAuL8jJBCh4ielq6HMDWF/U1G lsHtbcpLRz1OZRMSCUjnLLaEYeX+LIoVNPoiZ5taHlACAj4Iwcrhq65VwK/Q6ngbA/n7 b+aIiP3bu5vWfYFcIULMEiulOfrQi3iYNlkdWVzaTDtjfP3qnyriri2SJzCaVxLXz810 7yiMMt5j+9dl+KLdX3gg3k7F4iAQbBKX/F1EhugEfbhJuSIU36brZDfUR5l/v+60HXCj 4ZtWM3y/De8xH+GKCWHGSghMONbnezJmFhSHeND6Ub0XEQ9KylcoOtoj/QBqSTo/dlAL a+wg== 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:arc-authentication-results; bh=hIKgpCysDnCicP6keMeh/4klpRWtEblBB1SCCTQ7iNw=; b=UyUYX8AIJEru2qOwb+x8KAiirSX1C3VSAfBLbmFrNOYt0kT5GRiACvw94SH6Qb2e7b osiy9fA4F9wv3mmru+6tUROIYHCKg2Jxc44FRvANchx/315Ntnb1PhMua9XIXwpE+3aB yvB5/ayPp8IvWl0pIJAXRaNeLMRk4O/1bhc+FI+DFN5N71bRvNbzQCjDsYw5Njvtkp9W P7uSq8NCJKRk3kc+9LGBa6vL3mr0R6D9jDT4JaVqvryH1t/wLimP0TrId11V1Y3dN3yy nlve/0kqT+X+hbvAjftz3Q+0GSDTz1uu8kiodE91vep2l+4kbvMONxEOde0s5gdoIbwZ In4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ZbjOte8i; 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 f90-v6si9360483plf.496.2018.05.01.06.05.16; Tue, 01 May 2018 06:05:31 -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=fail header.i=@gmail.com header.s=20161025 header.b=ZbjOte8i; 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 S1755186AbeEANFF (ORCPT + 99 others); Tue, 1 May 2018 09:05:05 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:40158 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754867AbeEANFE (ORCPT ); Tue, 1 May 2018 09:05:04 -0400 Received: by mail-pg0-f65.google.com with SMTP id l2-v6so8311847pgc.7 for ; Tue, 01 May 2018 06:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hIKgpCysDnCicP6keMeh/4klpRWtEblBB1SCCTQ7iNw=; b=ZbjOte8iXQitQq1AWvFtFJl1yXt/qwY49ghCfg+ptfTzPSC5f8E3LDVObdN+b0FicN CRw+m7OnLQsiwg1OQEnplDLqxICaiLVb91XQhFkGUj5f+eAKBIpDHp5fZmFSTDtbxpTv nP1fQUpS/zQlMOD0kvLjY5bnVhTkhNrF+AskeTMyzTS5dOGE371pcZm2ac4bUTWuqDC1 9nwcm8OUY8iRwe8/rd3/NFwbHUev5Rq/B5JwY6dYikltj9zT+oHvlUsygpLQH+4CvIID R7QTxEAgCYMgDexZ5LvBxRzZh1AOMMUZSpq8VMx8+95iK5AU6h9ay0PvUmCA4mwzGIKG +Lkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=hIKgpCysDnCicP6keMeh/4klpRWtEblBB1SCCTQ7iNw=; b=ev7QfJsSTSBqlLTE/U1bOF+FdH7MQOsmq7TUwK4lZ4rLv3CgNLHdYQ2GJufYjO0yYP haB8l4nApOBKLu0WyrFcoWuq0ZYf4AyFoiQvg8zZqwumnLyM7Ulw0bX3TyNKfrGDxhAT K+wri0W3cV6oR7ke9Gepee1oLTtCW7hfe8yu1Bev76OTJOZY6baH/DPbPztA2y0igx+Q 5XKfKyDn+tUQ0n0KICur5/gFMut2G6RapsaMbukgzqbWtC7PFaFapTzdqhb/NR7aSmro y7O7P2Rxa5wVM3yYZtAbVj82UKwSf63mUsFZ2JA1S9wvdsfZHxSgFGuXb8OXa2LUn0IQ bKaw== X-Gm-Message-State: ALQs6tCRYl6onZs51Db4Z+lKeLUwnK/gnW5WenuBGJ0X8XnwAXO8woel jOlrS3mUTYZQn9pew6ZMh1Y= X-Received: by 2002:a63:2407:: with SMTP id k7-v6mr13056241pgk.63.1525179903213; Tue, 01 May 2018 06:05:03 -0700 (PDT) Received: from rodete-laptop-imager.corp.google.com ([122.38.223.241]) by smtp.gmail.com with ESMTPSA id 126sm18128066pfd.130.2018.05.01.06.04.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 May 2018 06:05:01 -0700 (PDT) Date: Tue, 1 May 2018 22:04:52 +0900 From: Minchan Kim To: Laurent Dufour Cc: akpm@linux-foundation.org, mhocko@kernel.org, peterz@infradead.org, kirill@shutemov.name, ak@linux.intel.com, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, sergey.senozhatsky.work@gmail.com, Daniel Jordan , David Rientjes , Jerome Glisse , Ganesh Mahendran , linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, paulmck@linux.vnet.ibm.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v10 06/25] mm: make pte_unmap_same compatible with SPF Message-ID: <20180501130452.GA118722@rodete-laptop-imager.corp.google.com> References: <1523975611-15978-1-git-send-email-ldufour@linux.vnet.ibm.com> <1523975611-15978-7-git-send-email-ldufour@linux.vnet.ibm.com> <20180423063157.GB114098@rodete-desktop-imager.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 30, 2018 at 04:07:30PM +0200, Laurent Dufour wrote: > On 23/04/2018 08:31, Minchan Kim wrote: > > On Tue, Apr 17, 2018 at 04:33:12PM +0200, Laurent Dufour wrote: > >> pte_unmap_same() is making the assumption that the page table are still > >> around because the mmap_sem is held. > >> This is no more the case when running a speculative page fault and > >> additional check must be made to ensure that the final page table are still > >> there. > >> > >> This is now done by calling pte_spinlock() to check for the VMA's > >> consistency while locking for the page tables. > >> > >> This is requiring passing a vm_fault structure to pte_unmap_same() which is > >> containing all the needed parameters. > >> > >> As pte_spinlock() may fail in the case of a speculative page fault, if the > >> VMA has been touched in our back, pte_unmap_same() should now return 3 > >> cases : > >> 1. pte are the same (0) > >> 2. pte are different (VM_FAULT_PTNOTSAME) > >> 3. a VMA's changes has been detected (VM_FAULT_RETRY) > >> > >> The case 2 is handled by the introduction of a new VM_FAULT flag named > >> VM_FAULT_PTNOTSAME which is then trapped in cow_user_page(). > > > > I don't see such logic in this patch. > > Maybe you introduces it later? If so, please comment on it. > > Or just return 0 in case of 2 without introducing VM_FAULT_PTNOTSAME. > > Late in the series, pte_spinlock() will check for the VMA's changes and may > return 1. This will be then required to handle the 3 cases presented above. > > I can move this handling later in the series, but I wondering if this will make > it more easier to read. Just nit: During reviewing this patch, I was just curious you introduced new thing here but I couldn't find any site where use it. It makes review hard. :( That's why I said to you that please commet on it if you will use new thing late in this series. If you think as-is is better for review, it would be better to mention it explicitly. Thanks.