Received: by 10.213.65.68 with SMTP id h4csp832674imn; Thu, 22 Mar 2018 09:30:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELvmihaJ/gNkjInW1yJswt/wYy8SgHkf8aUN0TeGbAHvYLFz/ub2kQT52UjOAMzbrYsqd9xU X-Received: by 10.99.43.70 with SMTP id r67mr7462095pgr.422.1521736249253; Thu, 22 Mar 2018 09:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521736249; cv=none; d=google.com; s=arc-20160816; b=il4oZXQDvBNdytAMVA6U2c5311HecLBIiNMVsXSkz+IxP8PWGg2ZANqaVXwv0YsZO5 pdTLKV6nCmXno41BqJNYMQA5tITXlbebIO06hzyZEaqYF8uRQQi/xSywFgJPgBF/QGni SnrG7hFyZsnBea6Q/3fywCFvhKf3S8Y68IeHVb+0SUcI/Hh41H6acgBei4UBGe2HgYGx udwufANVZaG7ZX7mnzxHw0CDk83XqVKhtF1YsVA8MGbpoBrDYv0jTsiUizRww7yjeVaa gX/bPZNThjHnzfgVtKR9Pv3ukeSXx58U60q/J8KOFOpr3uCGREM3m/ycC5m6cuyLgkeU m7BQ== 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=5yicar0h05g0f9ag8CiKB8fFiILGa4WeG5YIICjyXqA=; b=sjesRKfW/+OE1nTIDO0tR1VYtWbPlqo6M36RmsoPkib/urMKa107Cc3lufRRK2vEqj nUYKfICQ948saLXzAcGMOz1DK6giuQOlQ7mRRv6fwvcvIdcQ/shAyYNRcoHIe2x0Tt2Z 2V77gG+Ea7AO2sLVLcPDhdQRnP08P/OQt0NRMV1y6eYfa4U7ggNEn+95CIjp2ZVK0UNr ZTcv5D5xvT6s6KdDBSaJFYZxiT3Jx74SZrx5DhVWiua5yGPvjHD4xjRU7PjvpMFWbvpi vZWcmK4YHB2fHlYokafWeLSrIBZQsnGRDbFVOMMvkhBQg4W8Ok+Z7sbOAqCpMKu06/7z fZig== 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 f186si3763842pgc.527.2018.03.22.09.30.33; Thu, 22 Mar 2018 09:30:49 -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 S1751742AbeCVQ3D (ORCPT + 99 others); Thu, 22 Mar 2018 12:29:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39860 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751687AbeCVQ3B (ORCPT ); Thu, 22 Mar 2018 12:29:01 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2MGRo5w075300 for ; Thu, 22 Mar 2018 12:29:01 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gvf88tqm1-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 22 Mar 2018 12:29:00 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Mar 2018 16:28:58 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Mar 2018 16:28:55 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2MGStWr58327044; Thu, 22 Mar 2018 16:28:55 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DEBA6A4051; Thu, 22 Mar 2018 16:21:36 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 749B6A404D; Thu, 22 Mar 2018 16:21:36 +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 16:21:36 +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> <20180321131449.GN23100@dhcp22.suse.cz> <8e0ded7b-4be4-fa25-f40c-d3116a6db4db@linux.alibaba.com> <20180321212355.GR23100@dhcp22.suse.cz> <952dcae2-a73e-0726-3cc5-9b6a63b417b7@linux.alibaba.com> <20180322091008.GZ23100@dhcp22.suse.cz> <8b4407dd-78f6-2f6f-3f45-ddb8a2d805c8@linux.alibaba.com> <20180322161316.GD28468@bombadil.infradead.org> From: Laurent Dufour Date: Thu, 22 Mar 2018 17:28:54 +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: <20180322161316.GD28468@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: 18032216-0040-0000-0000-00000425E441 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032216-0041-0000-0000-00002628EDF8 Message-Id: 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-1803220190 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/03/2018 17:13, Matthew Wilcox wrote: > On Thu, Mar 22, 2018 at 09:06:14AM -0700, Yang Shi wrote: >> On 3/22/18 2:10 AM, Michal Hocko wrote: >>> On Wed 21-03-18 15:36:12, Yang Shi wrote: >>>> On 3/21/18 2:23 PM, Michal Hocko wrote: >>>>> On Wed 21-03-18 10:16:41, Yang Shi wrote: >>>>>> proc_pid_cmdline_read(), it calls access_remote_vm() which need acquire >>>>>> mmap_sem too, so the mmap_sem scalability issue will be hit sooner or later. >>>>> Ohh, absolutely. mmap_sem is unfortunatelly abused and it would be great >>>>> to remove that. munmap should perform much better. How to do that safely >>> The full vma will have to be range locked. So there is nothing small or large. >> >> It sounds not helpful to a single large vma case since just one range lock >> for the vma, it sounds equal to mmap_sem. > > But splitting mmap_sem into pieces is beneficial for this case. Imagine > we have a spinlock / rwlock to protect the rbtree Which is more or less what I'm proposing in the speculative page fault series: https://lkml.org/lkml/2018/3/13/1158 This being said, having a per VMA lock could lead to tricky dead lock case, when merging multiple VMA happens in parallel since multiple VMA will have to be locked at the same time, grabbing those lock in a fine order will be required. > ... / arg_start / arg_end > / ... and then each VMA has a rwsem (or equivalent). access_remote_vm() > would walk the tree and grab the VMA's rwsem for read while reading > out the arguments. The munmap code would have a completely different > VMA write-locked. >