From patchwork Fri Feb 21 17:42:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Geffon X-Patchwork-Id: 11397037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B7AD930 for ; Fri, 21 Feb 2020 17:43:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57DD324653 for ; Fri, 21 Feb 2020 17:43:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Uuw/Lr1H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57DD324653 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E748A6B0007; Fri, 21 Feb 2020 12:42:58 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E00176B0008; Fri, 21 Feb 2020 12:42:58 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC74D6B000A; Fri, 21 Feb 2020 12:42:58 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AFD466B0007 for ; Fri, 21 Feb 2020 12:42:58 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6F9CD4995E7 for ; Fri, 21 Feb 2020 17:42:58 +0000 (UTC) X-FDA: 76514854836.24.table24_8e51c1f35e20c X-Spam-Summary: 2,0,0,89fa1c52501d088a,d41d8cd98f00b204,3obzqxgckcacinlmmvunvvnsl.jvtspu14-ttr2hjr.vyn@flex--bgeffon.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2693:2895:2898:2901:3138:3139:3140:3141:3142:3152:3354:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4605:5007:6261:6653:6742:7809:7875:7903:8660:9038:9969:10004:10400:11658:11914:12043:12291:12296:12297:12555:12683:12740:12895:13148:13230:13972:14093:14097:14110:14181:14394:14659:14721:14819:21080:21220:21433:21444:21611:21627:21939:21990:30003:30029:30034:30054:30070:30075,0,RBL:209.85.210.201:@flex--bgeffon.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: table24_8e51c1f35e20c X-Filterd-Recvd-Size: 5838 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Feb 2020 17:42:57 +0000 (UTC) Received: by mail-pf1-f201.google.com with SMTP id r29so1660840pfl.23 for ; Fri, 21 Feb 2020 09:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=/P+y5vx/TxaR6L3Exm4hXUShsr11bB8XrVre0/LSmjk=; b=Uuw/Lr1HgKiaclFFVM4QuMMSK19Lx7kar70t8O1hQH72+spUWb//A+ll1YvWDIBOH8 tPFBeabj/Z1ysUHHoXOWGH2GVhPW0URCi1WklOpbT1vIs8OyT+5hRK+xLXk/2GAKs/v1 Mp2UN2gS9jLRZSlggDsios49d04onl/1RWELhh/S0IWHPiyVLZxuKNSEQtnnfra4APto cJtP43KHMaYzzwC1gau4up6bLwGv2hOTKBof9H3uLIHyhWN05YqRn1VKlb+KF3fh9ur2 oipqkOexMRzlCWGeatnaQUn1cD1dMz449QbytYmDlI68oDN30+KJ9wBY4FPrKwNAlOpP wEtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=/P+y5vx/TxaR6L3Exm4hXUShsr11bB8XrVre0/LSmjk=; b=IqkedSHi3QLYdw0cFRI2l7SOgI8OHVQ+9lfiSuoaa85AGhKEM9ZDtwKzdpUe5/4WE6 akDOm6oq+/FvscJglCEUzLR2Q/U+In9AdKQjJpF0obdhtFYAgcqAzTTU86R0d7e/rB9w e/b24KZSWRUtzT5rAcA47RT5r2Y5ibBAi9V0n/pKBr8mzyem9QShVO04qN9YrKbmCSdn yTzElUTkSOae4fm4dDD1UHvWcmoLBMxc3V3wtInuKYbbfLM/cihLE8+QaxvY6A8r6anJ odQmk2KDbSuH77vkokSD4ltrw7wTqGiWn9Ku+RMXglWC3yEwfoBMEuDli66U3C9YH9QC KPlw== X-Gm-Message-State: APjAAAUUy6Pxz9RJvmQ25MdHMbTAIJUb/N7DlwqLyYmMo1TBrvF/QkBx gx5zIrPjn5XB/7u9AitGDNut0g4QPM/E X-Google-Smtp-Source: APXvYqzOBT+mipzF7MvD+gaHRNmziAUAAa3agpZPSJC4Oxj2yqOyP5uevSOQcrFBRSZnIExGrmeub5QBA1cZ X-Received: by 2002:a63:8f49:: with SMTP id r9mr39964734pgn.190.1582306976655; Fri, 21 Feb 2020 09:42:56 -0800 (PST) Date: Fri, 21 Feb 2020 09:42:48 -0800 In-Reply-To: <20200221174248.244748-1-bgeffon@google.com> Message-Id: <20200221174248.244748-3-bgeffon@google.com> Mime-Version: 1.0 References: <20200221174248.244748-1-bgeffon@google.com> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog Subject: [PATCH v7] mremap.2: Add information for MREMAP_DONTUNMAP. From: Brian Geffon To: Andrew Morton Cc: "Michael S . Tsirkin" , Brian Geffon , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Andy Lutomirski , Will Deacon , Andrea Arcangeli , Sonny Rao , Minchan Kim , Joel Fernandes , Yu Zhao , Jesse Barnes , Florian Weimer , "Kirill A . Shutemov" , mtk.manpages@gmail.com, linux-man@vger.kernel.org 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: Signed-off-by: Brian Geffon --- man2/mremap.2 | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/man2/mremap.2 b/man2/mremap.2 index d73fb64fa..54ec67b20 100644 --- a/man2/mremap.2 +++ b/man2/mremap.2 @@ -26,7 +26,8 @@ .\" 1996-04-12 Tom Bjorkholm .\" Update for Linux 1.3.87 and later .\" 2005-10-11 mtk: Added NOTES for MREMAP_FIXED; revised EINVAL text. -.\" +.\" 2020-02-05 Brian Geffon +.\" Update for MREMAP_DONTUNMAP. .TH MREMAP 2 2019-03-06 "Linux" "Linux Programmer's Manual" .SH NAME mremap \- remap a virtual memory address @@ -129,6 +130,13 @@ If is specified, then .B MREMAP_MAYMOVE must also be specified. +.TP +.BR MREMAP_DONTUNMAP " (since Linux 5.7)" +This flag which must be used in conjuction with +.B MREMAP_MAYMOVE +remaps a mapping to a new address and it does not unmap the mapping at \fIold_address\fP. This flag can only be used with private anonymous mappings. Any access to the range specified at \fIold_address\fP after completion will result in a page fault. If a +.BR userfaultfd (2) +was registered on the mapping specified by \fIold_address\fP it will continue to watch that mapping for faults. .PP If the memory segment specified by .I old_address @@ -176,6 +184,8 @@ a value other than .B MREMAP_MAYMOVE or .B MREMAP_FIXED +or +.B MREMAP_DONTUNMAP was specified in .IR flags ; .IP * @@ -197,9 +207,17 @@ and .IR old_size ; .IP * .B MREMAP_FIXED +or +.B MREMAP_DONTUNMAP was specified without also specifying .BR MREMAP_MAYMOVE ; .IP * +.B MREMAP_DONTUNMAP +was specified with an \fIold_address\fP that was not private anonymous; +.IP * +.B MREMAP_DONTUNMAP +was specified and \fIold_size\fP was not equal to \fInew_size\fP; +.IP * \fIold_size\fP was zero and \fIold_address\fP does not refer to a shareable mapping (but see BUGS); .IP * @@ -209,10 +227,20 @@ flag was not specified. .RE .TP .B ENOMEM +Not enough memory was available to complete the operation. +Possible causes are: +.RS +.IP * 3 The memory area cannot be expanded at the current virtual address, and the .B MREMAP_MAYMOVE flag is not set in \fIflags\fP. Or, there is not enough (virtual) memory available. +.IP * +.B MREMAP_DONTUNMAP +was used without +.B MREMAP_FIXED +causing a new mapping to be created that would exceed the virtual memory available or it would exceed the maximum number of allowed mappings. +.RE .SH CONFORMING TO This call is Linux-specific, and should not be used in programs intended to be portable.