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=-17.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 F41AEC3565E for ; Fri, 21 Feb 2020 17:42:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CAE8324650 for ; Fri, 21 Feb 2020 17:42:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Uuw/Lr1H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729139AbgBURm6 (ORCPT ); Fri, 21 Feb 2020 12:42:58 -0500 Received: from mail-pf1-f201.google.com ([209.85.210.201]:41391 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729051AbgBURm5 (ORCPT ); Fri, 21 Feb 2020 12:42:57 -0500 Received: by mail-pf1-f201.google.com with SMTP id a206so1676213pfa.8 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=NFc1Kyc/p36oPHLgoN5c5c2SvQA/ixDPWlj01vZDBB2wc9EFk/4jYAcclPQAmL9slD olJjL+AzxHQRqRk9aGpcDGuFBEsmG/Y2/P/T13/HA6oUifdZ1fjt+p+Z6D7WLzpzTDBU xFp51Ekhrv/QNodxdyoJVrGQGanqVtr8sh+m8m31Dn1LDEwt4iTNwU1Nu8cklBZEa7a5 48frn2rTodL0whEeMQq8ehpeD5aG3p4QWGyaaYmNxtN/Ls/Efvctkpa5AZXsC0P0t1gZ pionHXkcpVmjrsDkikkRu4HMnUWIPJQ0+wgkrH64bBld5bVX0kIXExNaO5L/NLmY33KY +FRw== X-Gm-Message-State: APjAAAX7y9ZcoM6FNo/PmF7moqqiyY5UyEzl+GN4x499c5W8nnObYhZS y70kcvLE0q2UR6jkArfN0hU6kF5ZVv9C 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-man-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org 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. -- 2.25.0.265.gbab2e86ba0-goog