Received: by 10.213.65.68 with SMTP id h4csp184295imn; Wed, 28 Mar 2018 01:17:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/vMTlExMCe7gzsWoMZL84f+XsES/Q7FcKpn739SVNWupfWFe/8HsWS1Eg9z5ghs5rvw95A X-Received: by 10.99.56.83 with SMTP id h19mr1851438pgn.230.1522225065975; Wed, 28 Mar 2018 01:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522225065; cv=none; d=google.com; s=arc-20160816; b=pLA+rpiBMYbbePaNhzoQS9Rh2g8x1YQ7TAEKYvttkJUh6fK7YpLOHUewGyyNbI81sV SUk+g1LUiaJu0hrhTwOhvyM8IU00sWmnN2pGNHHFVXxBoPdwkAjJnebIg72kQJd960qi mHTKWgoZtO0aGGGZkP1CmAWzvydmPpLgnmnsAEfiPjHUeujmCkL7gatJx2Mst/tg7tZL WonKuXXA8kbEDvPJCZWMle8iAK42TSgkz3BmkxxDbWpNuhq9dqmcrsUmjOPg3ugEPiMl +T6ybXxyHATPKLx9j/k+rcv7qply23lYAoBm1EsxG3xknpehkBVqMidwXKsNULGbeW1T O8wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=w8kNPpVepDmLoNc7ngPgZO5QM4g7wXv85I0F/yG4zBU=; b=vqdZe5/5VH4S2DJBw9r7bYhUavjcAOdB2vdlZ6QuFve9aazbUG7yxH9aukuyU9vkko AQle0xYRLxt6u+EQbGp9jAHCnV4JOAblaWNTSQUfx2C+mFhV++XOSkMhs7HQtwqQDd2A vYcIB51mRT4qdcS3IcM91qpF0fLwAHF4rmZB6F3lwxALSfmE6+yZf3n52m8qMSTPrf1d SURdnu48NRyzDIcFkSBr8a1s63DqmRreQR3UOK/xhWB4cqXIQdgYsZx0qhkhWgaMQKbi VDYSm8otOk5N+sCZO9U/efZrK4lX7ASTi5row2QyvYPYroZ6nyuk8WrT/M183BRmYIWP pVMQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10-v6si3007764plk.689.2018.03.28.01.17.31; Wed, 28 Mar 2018 01:17:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752258AbeC1IQi (ORCPT + 99 others); Wed, 28 Mar 2018 04:16:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33774 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751191AbeC1IQd (ORCPT ); Wed, 28 Mar 2018 04:16:33 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2S8Dtkv135246 for ; Wed, 28 Mar 2018 04:16:33 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h04v7ps80-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 28 Mar 2018 04:16:31 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Mar 2018 09:15:57 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Mar 2018 09:15:49 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2S8FnGF4456828; Wed, 28 Mar 2018 08:15:49 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 681F752049; Wed, 28 Mar 2018 08:07:05 +0100 (BST) Received: from [9.145.178.80] (unknown [9.145.178.80]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6E03552047; Wed, 28 Mar 2018 08:07:03 +0100 (BST) Subject: Re: [PATCH v9 05/24] mm: Introduce pte_spinlock for FAULT_FLAG_SPECULATIVE To: David Rientjes 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 References: <1520963994-28477-1-git-send-email-ldufour@linux.vnet.ibm.com> <1520963994-28477-6-git-send-email-ldufour@linux.vnet.ibm.com> From: Laurent Dufour Date: Wed, 28 Mar 2018 10:15:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18032808-0040-0000-0000-000004463BCC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032808-0041-0000-0000-000020EA49EB Message-Id: <56b596fe-f235-7033-348b-b0d6c9481f2c@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-28_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803280084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/03/2018 23:50, David Rientjes wrote: > 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? You're right. Indeed this was done in the patch 18 : "mm: Provide speculative fault infrastructure", but this has to be done there too, I'll fix that. > >> +{ >> + 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()? done in the next patch, but you already acked it..