From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 977EAC2BA83 for ; Thu, 13 Feb 2020 12:07:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B04D2073C for ; Thu, 13 Feb 2020 12:07:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="M2VUGBwX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729588AbgBMMH4 (ORCPT ); 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-Google-Smtp-Source: APXvYqzRZafNFtZ7svPxheBqNfpYjdJ0hTorPlw//lqT7d/AG1y7sL+dI4mgR5yoxZFKIbMgc8OsaA== 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