Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp340482yba; Wed, 3 Apr 2019 09:41:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqylWU49xJYtyOYsWdQi0qnnNu+eFeofMcCkIwJxj2bzeYyjwulPNfBzPkqurJUzunWE2K2Y X-Received: by 2002:aa7:8d01:: with SMTP id j1mr422148pfe.122.1554309671978; Wed, 03 Apr 2019 09:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554309671; cv=none; d=google.com; s=arc-20160816; b=cOBvOWHiCe0LZL8lHTw2EN/NqAxxSBFmSxGg561KYvjMAIRh0wkoLNfXH+Qv7u0iPn Fg89yvaOXwei2Mu2Eo+d66gYh3+1Ue1nocBi8lo7aLFq1c2YZ72BZap2b1UjrAjJ2kQS FQLJyMK2mU1DO9Bif3ogA+FT3xaJZLA+nSrqxpkBkSRApzfBVOJzOpIk39gNAVtZZMe7 xJMtOsuO1v9RYBrtj6xDYZIi5tfHK31Xc1lTM5xYVggYQDdUbyCU6dc4Ita4ivYdKclA 2XjoNPaXcY4tGxNBhaC+KpY9/g741qZN5xtfU1wKuLczGE2cGubUjWZBjfuWeCUw40jP xMaQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NjqszMs7E3gOIGdwaUNs0dj+AbjCWmOyC3cb7a2Lz70=; b=LzSN/kttJRfP+Dctgoie6OYGRJipsj3DlD7pgmS0q2qZ8VHP0y9VjznL6ae+hupShf VozCuuBHuaJUfDFr0Pj/ghk80u2xrxmeNXmGmOAgEbJcbYvR/JEQLt1XIAFoDatKBxGD mgaWax/2vG3eAmVI0ih9eoPQItwikkCsKpoWYGr0pt7nUxPlFS5XqCXRC5PPvQFv2A5A zBlkzCC1802s/4uU1Mp24M4OnwFX5GX+YRTfkXrS/ih0iahLxK4jKqYZpPyLocjkG3y/ pY6w8y09kpROCpEJbmPUX1Wc4Rrrm3DhFCPX12wQMXhf6ucwiK+cYfArpdx9hd9/DtSz dNrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=wDb1seI9; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q61si14804948plb.252.2019.04.03.09.40.56; Wed, 03 Apr 2019 09:41:11 -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=@oracle.com header.s=corp-2018-07-02 header.b=wDb1seI9; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726376AbfDCQkP (ORCPT + 99 others); Wed, 3 Apr 2019 12:40:15 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:36254 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbfDCQkP (ORCPT ); Wed, 3 Apr 2019 12:40:15 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x33GY8DS123283; Wed, 3 Apr 2019 16:39:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=corp-2018-07-02; bh=NjqszMs7E3gOIGdwaUNs0dj+AbjCWmOyC3cb7a2Lz70=; b=wDb1seI92hgo522RHXd4reMB9zkAqMls9VSvgcdjUxogKDD5J+hXR5nIQ6e1RF5nvfeJ yvo1WDLR0+cay945s5CowFcHd3jjzFZsf4NS8tDvswsKUon3j/9rmrDfnflM2DN40AQC p89U9xrMzz6NfdNVkdZKpfv+QO+E+XcrFHW3a3bW3Yscf6TYAeMXf/MfLJT019LJdBfK qdoyh/i9H5STZJHeLFWFhiumH7e2qsq6PZgeEevBUBevAR/O89c1IO+XNEmBYeTXoSRa fe8vgBSoITQUVaIUvHmDjdmDSMaVpIu9e2EuZje9U7/e6xrb5k3v7b3RkbJWxOWfEWrK Jw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2rhyvta869-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 Apr 2019 16:39:41 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x33GdLsm003451; Wed, 3 Apr 2019 16:39:40 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2rm9mj5jn4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 Apr 2019 16:39:40 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x33GdZSM008090; Wed, 3 Apr 2019 16:39:36 GMT Received: from ca-dmjordan1.us.oracle.com (/10.211.9.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 03 Apr 2019 09:39:35 -0700 Date: Wed, 3 Apr 2019 12:40:02 -0400 From: Daniel Jordan To: Christophe Leroy Cc: Daniel Jordan , akpm@linux-foundation.org, Davidlohr Bueso , Alexey Kardashevskiy , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Paul Mackerras , Christoph Lameter , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 5/6] powerpc/mmu: drop mmap_sem now that locked_vm is atomic Message-ID: <20190403164002.hued52o4mga4yprw@ca-dmjordan1.us.oracle.com> References: <20190402204158.27582-1-daniel.m.jordan@oracle.com> <20190402204158.27582-6-daniel.m.jordan@oracle.com> <964bd5b0-f1e5-7bf0-5c58-18e75c550841@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <964bd5b0-f1e5-7bf0-5c58-18e75c550841@c-s.fr> User-Agent: NeoMutt/20180323-268-5a959c X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9216 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904030113 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9216 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904030113 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 03, 2019 at 06:58:45AM +0200, Christophe Leroy wrote: > Le 02/04/2019 ? 22:41, Daniel Jordan a ?crit?: > > With locked_vm now an atomic, there is no need to take mmap_sem as > > writer. Delete and refactor accordingly. > > Could you please detail the change ? Ok, I'll be more specific in the next version, using some of your language in fact. :) > It looks like this is not the only > change. I'm wondering what the consequences are. > > Before we did: > - lock > - calculate future value > - check the future value is acceptable > - update value if future value acceptable > - return error if future value non acceptable > - unlock > > Now we do: > - atomic update with future (possibly too high) value > - check the new value is acceptable > - atomic update back with older value if new value not acceptable and return > error > > So if a concurrent action wants to increase locked_vm with an acceptable > step while another one has temporarily set it too high, it will now fail. > > I think we should keep the previous approach and do a cmpxchg after > validating the new value. That's a good idea, and especially worth doing considering that an arbitrary number of threads that charge a low amount of locked_vm can fail just because one thread charges lots of it. pinned_vm appears to be broken the same way, so I can fix it too unless someone beats me to it.