Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp475393ybv; Thu, 13 Feb 2020 04:08:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzh7lViJi5GUUNSXiFWFmzzRzFBhfi2QaE0n/eCixibjZaKN/bmk8G5YCqA+1/EubvHfLVt X-Received: by 2002:a9d:5786:: with SMTP id q6mr12551847oth.164.1581595707307; Thu, 13 Feb 2020 04:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581595707; cv=none; d=google.com; s=arc-20160816; b=TcF98tJfVrEFvl7bPmXsal9qEVj8CyQsvNWcp+qTbvk1ac3k/1aSBpXZc3YNuIaG9T E1GUZdgrQHcaSHCmQw9/kBFt5LA9mTwC7GKGrbA+Su7O/ZT7LMGX6Th2YOdAfuOszHNW IrjK/EgcL/fW0T5jegn3GVKTyedRGj4tIovhq754eok9p2wkbhuiMeMNpB/gknsB8d7U 3e5pwWzF5OBx7dsW+Vj/YZuGruZFkYPHzaWCaL4WwGr3XnPQfl2beFjmkowxTQVAxKhF R/ya1WzI8hpEanSLBHhLsjWE9uNX94RFi9OA8c1YM++VXG+QSeZu4kK9aK1Yqz5MkVWP vnIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=rd4xaLNS2AIxfYvKAvmcRdDCWeLjTTZtNYujj0pjgMk=; b=QhchTBMbW2hmI/2m5C47t27cCwvnVs/epPraN4ncgpBAkJ/K6hbsRfwMPjNDMDhect V6bU7Wj20bfZe9VZsn6tonywJufM8RM325HvUIybroyfePcRoBXIwY/ECZBZRTf7sMa3 dOV0LYKQ0ddMpwbi+YZbJKBiEr/KzVWhHUcBZJ/+xR6fPgNMLK5KAcocJTS9dqOV4oar xAvRBGfAassqHIjCQdwMAlB9ME9KUmjBVWPCNgYP31kBAFC8e+5xhIsHFtxBdhuO6f9Q ibIwbEc+djI7Ruboq93QgHRacG14gJTcCCylO/TvTplnDgzF7DMdFjv22QnZc9Y13I7L JdZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=M2VUGBwX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26si1038457otk.305.2020.02.13.04.08.14; Thu, 13 Feb 2020 04:08:27 -0800 (PST) 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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=M2VUGBwX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729903AbgBMMH4 (ORCPT + 99 others); Thu, 13 Feb 2020 07:07:56 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37693 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729532AbgBMMH4 (ORCPT ); Thu, 13 Feb 2020 07:07:56 -0500 Received: by mail-lj1-f193.google.com with SMTP id v17so6306438ljg.4 for ; Thu, 13 Feb 2020 04:07:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rd4xaLNS2AIxfYvKAvmcRdDCWeLjTTZtNYujj0pjgMk=; b=M2VUGBwXg+/hd3puU06yqac4zRaPvTXXLIfZyt7OjuKT9vRMrYDFEIQohg/D5vOFZQ nbg0WHbiwqy/kGwYFjnGfLBMmLqRvuVZSJtsYy0S8L552R0g3ge+GHkCMeTQrK0DBPHS w7uqIIdq67ZrCExXrDr9zava1s2YEPAqOHmnWdY45wHHFGhJ1lyfBz5OU6BkjWYmdM1J b/fZ4bIf9RHofk698C92yzSG2lGvuXs+Po3PG+jOJvqhBz6KWQgOnfGjKrOTZB28eLjk 7NCFR097N16PT+COcEm3RBl5PMNU8IS4NgqXMlak3BXwJvhgTbmdof+1ZwDgX7aYlTVL V94g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rd4xaLNS2AIxfYvKAvmcRdDCWeLjTTZtNYujj0pjgMk=; b=szhekDJgswk7Fe12DBvjnYRAROmL1653hZKFXbdqtajpukEuzI8Gtsv7/IO9Mbm69j lNzhTPI9QUivYqfPAU4/Tf5iVM5sxpncIuWZVXY5lgSW9jt9oRSmBdTVJyKxkU4+DoDo QvyqEsj4eYLJSrtK4iIqnks+PRLpF4Ofx3uaceMr2Ox5X6mcpffxRY2XuUrUQ+l3xFU5 iyIpyzmQBJwhExYzqzqUS/Bjyo/1O3pfgpa7oBPkrgGph3zxxldLVD2x5YHNdQ9I1v0S po4HIOD4wpN/S6LGnGW5yZem+TtyPXP/1Ybn2Ad7UiEtl797EEYHnZY50+NP/qOVKPuQ hnMQ== X-Gm-Message-State: APjAAAXrsZBIn0G+LHvunhdbc9sD0dVqRxa+/FUrBWdHwIcPwXbkjA9Q O+Jva+O6IA97rqlFeCfZb7hVhg== X-Received: by 2002:a2e:a402:: with SMTP id p2mr11283717ljn.143.1581595674356; Thu, 13 Feb 2020 04:07:54 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id z8sm1300685ljc.44.2020.02.13.04.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 04:07:53 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id DE1C5100F24; Thu, 13 Feb 2020 15:08:13 +0300 (+03) Date: Thu, 13 Feb 2020 15:08:13 +0300 From: "Kirill A. Shutemov" To: Brian Geffon Cc: Andrew Morton , "Michael S . Tsirkin" , Arnd Bergmann , LKML , linux-mm , linux-api@vger.kernel.org, Andy Lutomirski , Will Deacon , Andrea Arcangeli , Sonny Rao , Minchan Kim , Joel Fernandes , Yu Zhao , Jesse Barnes , Nathan Chancellor , Florian Weimer Subject: Re: [PATCH v4] mm: Add MREMAP_DONTUNMAP to mremap(). Message-ID: <20200213120813.myanzyjmpyzixghf@box> References: <20200207201856.46070-1-bgeffon@google.com> <20200210104520.cfs2oytkrf5ihd3m@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 06:12:39AM -0800, Brian Geffon wrote: > Hi Kirill, > If the old_len == new_len then there is no change in the number of > locked pages they just moved, if the new_len < old_len then the > process of unmapping (new_len - old_len) bytes from the old mapping > will handle the locked page accounting. So in this special case where > we're growing the VMA, vma_to_resize() will enforce that growing the > vma doesn't exceed RLIMIT_MEMLOCK, but vma_to_resize() doesn't handle > incrementing mm->locked_bytes which is why we have that special case > incrementing it here. But if you do the operation for the VM_LOCKED vma, you'll have two locked VMA's now, right? Where do you account the old locked vma you left behind? -- Kirill A. Shutemov