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 C2E82C3F68F for ; Thu, 13 Feb 2020 12:07:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87783218AC 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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87783218AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1E3F36B0532; Thu, 13 Feb 2020 07:07:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 194656B0533; Thu, 13 Feb 2020 07:07:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A9996B0534; Thu, 13 Feb 2020 07:07:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id E5CB66B0532 for ; Thu, 13 Feb 2020 07:07:56 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 64C94181AEF10 for ; Thu, 13 Feb 2020 12:07:56 +0000 (UTC) X-FDA: 76484980152.27.trade15_625bf8066832d X-HE-Tag: trade15_625bf8066832d X-Filterd-Recvd-Size: 4451 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Feb 2020 12:07:55 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id x14so6266447ljd.13 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=me5teRvknL+gcdMxH6WurRf/RPF4rhaRSfHCGDVBC/W6Mh5m4E+Dsok6WMjNfKPpGZ OM7xPXAX1q0yCtYMEpOBYsdasR4970RkSSUKemVVGCDArHnS5M64N36n44gBSP1Q3cam XZxc/CGnr18bqRD2Gs/gZV2hDAh68jjnP4IojX7M6SRr5tNZ874BaLVjnAXRlGDTHlrm ov2qkdb/FuZEJiIBPOaeS6wW0UN+UcvI7Stj4FdcJLP7RFGPPzR3g2KC5Yb15GS4jIXM km7AJzoqMNKalyMRB5J8JqCEdm7SeCgzMDYVPDYe40dbsB2EiLZsaD08ocZa7CgpGoUQ GPsA== X-Gm-Message-State: APjAAAV7kzCLV0yzrimuIYE8Ikul25DlsBhKG6etwGibKJJW9fh/1I0m 0iv0cbBBEmJIv8BOBzeivqoZNw== 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: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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