Received: by 10.213.65.68 with SMTP id h4csp795735imn; Thu, 22 Mar 2018 08:44:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELvQQ41rVfdT/a7lJX2ncpJd3CPEvPreqknohb1wDjeftpVPVKjaagWbLq7o4UiJxVmXhfoz X-Received: by 10.101.98.137 with SMTP id f9mr18006955pgv.6.1521733461142; Thu, 22 Mar 2018 08:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521733461; cv=none; d=google.com; s=arc-20160816; b=ybj9sNUqCvCiXbNI4Gd8an2N/MR3SZTSsD9up8U+Aolyec8HX2o7fO4xQCLxRFehLN ekPWPLKhMF3NFIGIbgffE+7HaC+R4tlwN3gYHUXbaGaVY4Ui7HVavjS5bUkbLqgaZIyZ R6mMAiforrXm2CsZgvhOJurkmw7JGp0MwCW8TEHYDXjZJnB2HWj7TpU0079TWvEoEpZF DHQMD30mzRl2TYvfOAZGarRYPSUdycxvaJBukK28vNdSOP5BnfaCUp09eLAGBw4ssGcq fiyPMXjGF+FloCvBqvgDxmJJRylM8dsRB8jS9MsfwJaJdzwCmp9ZNs5AzpF3cV5JHxmu kUTQ== 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=tkyR3MePR8bHGjA7JH0jThj6o1C81A3f8IJ8GTg6pvk=; b=excxL6R2ueheEEPbRJ8ppJ7WTBLCMmzUjus3J//eClTi9XUcaKIKxIsJbLnyH3uVed UOgwNzXEjjOk7iBMsiLyGUWBzxFmlBCpVio2IREryWLsMdhlz54mUeQ3mOVYuS9Xpu9q x+XGcmBuOYin6oxx6W/e5loaNuVrNfvfgrCtytf9YwA6z8seLySKPh07BBVI4yce1nGL jolqmFhloaGZ1M758dpQdoVbzvpZgDaqDaVIDgjJcQoKzsiz8Y2voC4l0VUn2fdULORV zqaapFui/8wPxnqR0pJ/x1dRwVYlSbmB4WiGPn3APvNW7BkgAe63E65SzdJpFTl8Ovmd lPDA== 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 1-v6si779007plt.283.2018.03.22.08.44.05; Thu, 22 Mar 2018 08:44:21 -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 S1755420AbeCVPcb (ORCPT + 99 others); Thu, 22 Mar 2018 11:32:31 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50768 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755187AbeCVPcR (ORCPT ); Thu, 22 Mar 2018 11:32:17 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2MFVE0p118556 for ; Thu, 22 Mar 2018 11:32:16 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gveuhhg0t-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 22 Mar 2018 11:32:14 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Mar 2018 15:32:03 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Mar 2018 15:32:01 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2MFW1xE56360988; Thu, 22 Mar 2018 15:32:01 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A55C0A4055; Thu, 22 Mar 2018 15:24:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C2D2A408A; Thu, 22 Mar 2018 15:24:42 +0000 (GMT) Received: from [9.101.4.33] (unknown [9.101.4.33]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 22 Mar 2018 15:24:42 +0000 (GMT) Subject: Re: [RFC PATCH 1/8] mm: mmap: unmap large mapping by section To: Matthew Wilcox , Yang Shi Cc: Michal Hocko , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1521581486-99134-1-git-send-email-yang.shi@linux.alibaba.com> <1521581486-99134-2-git-send-email-yang.shi@linux.alibaba.com> <20180321130833.GM23100@dhcp22.suse.cz> <20180321172932.GE4780@bombadil.infradead.org> <20180321224631.GB3969@bombadil.infradead.org> From: Laurent Dufour Date: Thu, 22 Mar 2018 16:32:00 +0100 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: <20180321224631.GB3969@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18032215-0040-0000-0000-000004443C8E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032215-0041-0000-0000-000020E765DB Message-Id: <18a727fd-f006-9fae-d9ca-74b9004f0a8b@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-22_08:,, 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-1803220180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/03/2018 23:46, Matthew Wilcox wrote: > On Wed, Mar 21, 2018 at 02:45:44PM -0700, Yang Shi wrote: >> Marking vma as deleted sounds good. The problem for my current approach is >> the concurrent page fault may succeed if it access the not yet unmapped >> section. Marking deleted vma could tell page fault the vma is not valid >> anymore, then return SIGSEGV. >> >>> does not care; munmap will need to wait for the existing munmap operation >> >> Why mmap doesn't care? How about MAP_FIXED? It may fail unexpectedly, right? > > The other thing about MAP_FIXED that we'll need to handle is unmapping > conflicts atomically. Say a program has a 200GB mapping and then > mmap(MAP_FIXED) another 200GB region on top of it. So I think page faults > are also going to have to wait for deleted vmas (then retry the fault) > rather than immediately raising SIGSEGV. Regarding the page fault, why not relying on the PTE locking ? When munmap() will unset the PTE it will have to held the PTE lock, so this will serialize the access. If the page fault occurs before the mmap(MAP_FIXED), the page mapped will be removed when mmap(MAP_FIXED) would do the cleanup. Fair enough.