Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2225906ybg; Thu, 30 Jul 2020 13:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJTCcaUtCrlpOBfZv/wFKSA8pDMLOZNnGW/ny6K6HD66f361MgW8IXG5ZVCmYcrx2Knmbk X-Received: by 2002:a05:6402:d06:: with SMTP id eb6mr801668edb.211.1596142318087; Thu, 30 Jul 2020 13:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596142318; cv=none; d=google.com; s=arc-20160816; b=oWDzmf+C6fV79OkLD4ciPSHBU/8PF2SwR5kLRKVjgCfYzjxZagHtkh0jkMg+bU1Ul6 CdQxOnPYR5I71c2v0o9XpYBXAlLFmfHjF0wgjM0U+FKgEnebu3e20ZGTS0mpF+N0qIc1 P8sY1cGFkmpiDJsEPlsyXUYF6UBqQuk/YO7nqn7z9avfF59vrGxqk6+l+nbCMpNfjXJq SlF//FtFl0sscnaDVakl/kbe3AMaVjH3r89j52KImUFgHVZHUf/JQi0h1rO1G4CC1pfX r+qJVjGUOxTgAJzyOA/tgEEd4aSwhO7Wq4OjLuKDUbucpEpcnRrqKNrevz5ctq3sHYHt S1eA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Cqjec/JmJLo7a5VR/JGr2Y+AIOuHwIGHZrb6qGXqEIw=; b=hEv1gktiDv+vzJmMEi28SOoFEhWJHSiQdWnivYj7Gj9r6lLOtgvFEpNOM1pTl7Lao7 VFHHRNqlQaOyXKCxdFQ1kY6xi94DC+o+F+Dfd5ufxygN1TEwnNB/JbRw5XaoSVK8Dgdw RuaxjCEQjfmnwJpYvA9dNYPcQTT1vTdjw4JTqHCw0IWOsNnGkBV4EOZjZ2yTJItt4zna /D+mabOF/B8jTvMuk1hZNbMoutZMX8ULbl6vLph9+8X2cWiv3+KhmLZeNdkKPxIT+Mtu rbFlOvZHDsJPYN+Bgde4A3cHVuXn7cq4cuaXp4M19wmY9lsQUWjqOJhGGJsY9nkbl8YY uXnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=ciwC00u6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y8si3838709edo.253.2020.07.30.13.51.36; Thu, 30 Jul 2020 13:51:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=ciwC00u6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728682AbgG3Us5 (ORCPT + 99 others); Thu, 30 Jul 2020 16:48:57 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50208 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbgG3Us4 (ORCPT ); Thu, 30 Jul 2020 16:48:56 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06UKgHEh101584; Thu, 30 Jul 2020 20:48:26 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 : in-reply-to; s=corp-2020-01-29; bh=Cqjec/JmJLo7a5VR/JGr2Y+AIOuHwIGHZrb6qGXqEIw=; b=ciwC00u6FHi2+R0x/txxaIzTO2qoFcexcEIhCYoUaE/+dwmKZdvBI8hyBxuqGxFLWpxp 9ntMbAL6HK55vNU5fyrXeSiPBc5Z5XRVRZ4J3PvdQ9GDsDTOp69bs/Msh9MD/wnS/0+K SGyNfYKtS5dI62EOL8+iI8aPeQJ44dkmIALCgWQoAhHqoqUe6Iog/iVYS+Fu02Tb8VJZ MG9m3TE/uK32EfoqICucDUORK10MfudmTHDmfp/oiSrtdUcjHp7SWXfh+ew0rzh8ugGA tMB5OmKwfsmJqfK9w4APUIXHw26fmr3CK2835ENRlFNPAwJJhJMVLY21BUqOdgE+IeGI CQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 32hu1jwwf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 Jul 2020 20:48:26 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06UKhSH7161581; Thu, 30 Jul 2020 20:48:26 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 32hu5xcnst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jul 2020 20:48:26 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 06UKmGi1032069; Thu, 30 Jul 2020 20:48:21 GMT Received: from ca-dmjordan1.us.oracle.com (/10.211.9.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 30 Jul 2020 13:48:15 -0700 Date: Thu, 30 Jul 2020 16:57:05 -0400 From: Daniel Jordan To: Hugh Dickins Cc: Pengfei Li , akpm@linux-foundation.org, bmt@zurich.ibm.com, dledford@redhat.com, willy@infradead.org, vbabka@suse.cz, kirill.shutemov@linux.intel.com, jgg@ziepe.ca, alex.williamson@redhat.com, cohuck@redhat.com, daniel.m.jordan@oracle.com, dbueso@suse.de, jglisse@redhat.com, jhubbard@nvidia.com, ldufour@linux.ibm.com, Liam.Howlett@oracle.com, peterz@infradead.org, cl@linux.com, jack@suse.cz, rientjes@google.com, walken@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] mm, util: account_locked_vm() does not hold mmap_lock Message-ID: <20200730205705.ityqlyeswzo5dkow@ca-dmjordan1.us.oracle.com> References: <20200726080224.205470-1-fly@kernel.page> <20200726080224.205470-2-fly@kernel.page> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9698 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007300145 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9698 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1011 mlxlogscore=999 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007300145 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 29, 2020 at 12:21:11PM -0700, Hugh Dickins wrote: > On Sun, 26 Jul 2020, Pengfei Li wrote: > > > Since mm->locked_vm is already an atomic counter, account_locked_vm() > > does not need to hold mmap_lock. > > I am worried that this patch, already added to mmotm, along with its > 1/2 making locked_vm an atomic64, might be rushed into v5.9 with just > that two-line commit description, and no discussion at all. > > locked_vm belongs fundamentally to mm/mlock.c, and the lock to guard > it is mmap_lock; and mlock() has some complicated stuff to do under > that lock while it decides how to adjust locked_vm. > > It is very easy to convert an unsigned long to an atomic64_t, but > "atomic read, check limit and do stuff, atomic add" does not give > the same guarantee as holding the right lock around it all. Yes, this is why I withdrew my attempt to do something similar last year, I didn't want to make the accounting racy. Stack and heap growing and mremap would be affected in addition to mlock. It'd help to hear more about the motivation for this. Daniel