Received: by 10.213.65.68 with SMTP id h4csp825295imn; Sun, 25 Mar 2018 14:52:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELtqqPmyuN9Y/Y+69TTq7T86RogUsea4yoGb0gDkqeHytB+0n0ZeKF+NeKnAbSNx42IQy3G7 X-Received: by 10.98.242.6 with SMTP id m6mr15585781pfh.170.1522014749163; Sun, 25 Mar 2018 14:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522014749; cv=none; d=google.com; s=arc-20160816; b=U4bU2vj3KHhQVIxUb5B9b9ReDlMZ2P4j4KJYzHGDqx+fVop7lDeltaUJllIeQzGPmI CgLFdZKw/POZFZbYGCoksmnDaTDaSoCanRlOTjWBzqDG8IAd7EKxY+N1Y4yFHuAaPSXP 724aWtktW4MpDp0YQEGRZ373K+2zR3ORwG85Qz/QXRR8jBhsepI1yVN024ieckdjkvVB MSfA4SfMpp3dYoeiZOlAedOItQwqN+wdp/e7CuS/0sLjSUlkzrPjBftonEff0urUKGHj sOkPvvkAbTJ+xpeuj8bP0HZNX0f1SA6uzBWS2oty+Pryasg01BKELvDEC33ausyi/nnO kGkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=JqVBa1eV9JGfQPguj86f9optQFV58BqbZjnlKjXbCa4=; b=io/SqLrKt32NjJC+tV3pj0T4VRn1+EBiyNAJHelN2vgsbCb4mGZenakocvD8za8kSa JpT8phEBygsJuBsVkyK40+/V1P+jqTLCub8DmT2KSL3X/hquIf+hWA3WKhC52btkoi5/ qev3t6f1xR2EgodUwP5rJzo0SGfEDYCEQ8uISI0RH3UskKSnX8nndmSYFpAebcpHPhXD j04xPdgJEedk+BlKibhDnAI1D4vRY5jyN/f6LONtA/XV+B8p/Z3TWv1LqV9EXWOC5Mji dYDysYaPEdD4wwUvI7Sa4W1X8PoMpi5SndL/btBzmAeIHEjMRAYOZIgoe5vJNyARBGXk hgYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BCxdECsn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si9116957pgs.356.2018.03.25.14.52.14; Sun, 25 Mar 2018 14:52:29 -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=@google.com header.s=20161025 header.b=BCxdECsn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752481AbeCYVub (ORCPT + 99 others); Sun, 25 Mar 2018 17:50:31 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:39524 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752275AbeCYVuQ (ORCPT ); Sun, 25 Mar 2018 17:50:16 -0400 Received: by mail-pg0-f66.google.com with SMTP id a19so6554351pgw.6 for ; Sun, 25 Mar 2018 14:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=JqVBa1eV9JGfQPguj86f9optQFV58BqbZjnlKjXbCa4=; b=BCxdECsn2tKF2oe6DDI1QphBCfNUg6ioAPO1UKEGGI87qajllA/EVjUEIw2tKkvN5j mB0nFHeVQxv4cJxGwIo6W+sRN9iAZnoU3LrQqzPspM6TEanYOvylojtTEjYzEgDD0s7y 1eTK4RrmgF9LJlx0OPQKh+EsKbiETtFe5g/3bRYIx0gaEkN/eaoXM6Gnrxu5z3OpSz8K ATAjFkBvcJldPf7U8AkLFIYs7WPmjZ/Ku6OgQ9b/aYRcXbIBvVW2pBl3ZufRRmxWxGGr vxmV4ebVx+Wc5jTYUs63q4r+Fsz3xhH5nO6uF6Y110EOadVUgzZg8GcS1BxlLva1t5eA 3S+g== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=JqVBa1eV9JGfQPguj86f9optQFV58BqbZjnlKjXbCa4=; b=aVe+mgFgNjRKKo9AtXPOWgIC1UendnVR+Hq3jrEJN35mkirK9SX6j3FWje9LTNxG8K Inl6iVVeIsLsG5ZZBg9422Hf5e1dI3ee8qrRGzhRn9q+ZvJaBdXVQ8aUkLZCVzNERqnS 1OlmQZwT17s4r7LSFEB6Vo5Ify7PYcsF4Wz6QM47oexKqTL/EMs3khcDrOhCs7hxEhQ3 jAzlmV+jGEOq3B69cO+vkm243SOanEZ/2NpE3ZXgW72Lz/Qc2/NWNE5owETLMQJQqcHq arqVazBEu5vwwUNWq7DOaD5Wt+m5V1zx0ROU2gxap1ouhfSuP38C4fIy1lAhxPQc9p3m Obxw== X-Gm-Message-State: AElRT7EzyQ/NTsX+lXUauKI5EwATp31OHxa9tn6QPUFdLCav8r9jnxqT EnEcys3MT4rJ7PrxBzEIE128og== X-Received: by 10.98.97.1 with SMTP id v1mr31397685pfb.119.1522014616161; Sun, 25 Mar 2018 14:50:16 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id 189sm30292738pfu.44.2018.03.25.14.50.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Mar 2018 14:50:15 -0700 (PDT) Date: Sun, 25 Mar 2018 14:50:15 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Laurent Dufour cc: paulmck@linux.vnet.ibm.com, peterz@infradead.org, akpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, mhocko@kernel.org, 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 , 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, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v9 05/24] mm: Introduce pte_spinlock for FAULT_FLAG_SPECULATIVE In-Reply-To: <1520963994-28477-6-git-send-email-ldufour@linux.vnet.ibm.com> Message-ID: References: <1520963994-28477-1-git-send-email-ldufour@linux.vnet.ibm.com> <1520963994-28477-6-git-send-email-ldufour@linux.vnet.ibm.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Mar 2018, Laurent Dufour wrote: > When handling page fault without holding the mmap_sem the fetch of the > pte lock pointer and the locking will have to be done while ensuring > that the VMA is not touched in our back. > > So move the fetch and locking operations in a dedicated function. > > Signed-off-by: Laurent Dufour > --- > mm/memory.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 8ac241b9f370..21b1212a0892 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -2288,6 +2288,13 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr, > } > EXPORT_SYMBOL_GPL(apply_to_page_range); > > +static bool pte_spinlock(struct vm_fault *vmf) inline? > +{ > + vmf->ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd); > + spin_lock(vmf->ptl); > + return true; > +} > + > static bool pte_map_lock(struct vm_fault *vmf) > { > vmf->pte = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd, Shouldn't pte_unmap_same() take struct vm_fault * and use the new pte_spinlock()?