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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C389C369D9 for ; Wed, 30 Apr 2025 23:10:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1AA716B00A8; Wed, 30 Apr 2025 19:10:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 159CF6B00A9; Wed, 30 Apr 2025 19:10:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 020946B00AA; Wed, 30 Apr 2025 19:10:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DC2E36B00A8 for ; Wed, 30 Apr 2025 19:10:26 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2C640CAF95 for ; Wed, 30 Apr 2025 23:10:28 +0000 (UTC) X-FDA: 83392256136.13.E8E2EFB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf01.hostedemail.com (Postfix) with ESMTP id 7079340009 for ; Wed, 30 Apr 2025 23:10:26 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=A6OZF50p; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of alx@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alx@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746054626; a=rsa-sha256; cv=none; b=0aPlKZkEIj9FfqRbVvgxWVrPPJIHvtJp74OY4FUjNmOoaj6cBrKrsRH5U5ciIBVfx8veTQ jitzxV24SGE0P4Ssm5K+9mDSDDtSpCvCTJRLPcLqp4twpMG09+22htyyaIvN9N/YfbQHCm EHi69QQMJzJHjlVYY5rgtqQrkcZ2d7U= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=A6OZF50p; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of alx@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alx@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746054626; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FKxDBZdogFX06qCuziaXEONLEBmvyltBwRkDYm0u7q8=; b=w9hRWqiJZXwBDSaUmGpsj8kl7PTkUsuhrL+6XhbinAw++/uTSow4Lu/kOgwDHwL4v/6yXB bhDyxpEsRhlu6wrXq5Lvpf2d7UYfPz5rok78M4W3XK5qeXojtIcyT7tB2UJ66xicdVt+zc FLukIgMoOjgmm8szpLN71Sl7+fMh6eg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 548435C5437; Wed, 30 Apr 2025 23:08:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78363C4CEE7; Wed, 30 Apr 2025 23:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746054625; bh=9IKLpQ+X2KkZrDa7Jp9AX4qlkmg8eIlJiZoRny/6oGI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A6OZF50pI+hOM1NQxt43G4EwJqGDpZ7hPwN/XJTHqpNmIUDe/i0d216qrQQYqnhGN YY24/YDAykNJMH1UzCteGXm9OC1bS5NgoHRVs1XHkURneomF0axwVH0A4RrlXomDgI s01CRsN1UZlLeUQCsJnziiWQFNKEmI3xIy8tyUamI7dyr0/tWwSHt7ppfSrSVriRWm rOZC0ApIXHDJjlFYfpNkiUB6U7A7kE8pOWqVLQMxPuibikO8uJSiM//ddCzYr4Mzwn ot0faMxJ8jQqbH43S7MfuJI5PhZda+iS37mnyyeFV8c6SHDOMmtUwSImmkTGVm2LbC klrVlkb6c/rfw== Date: Thu, 1 May 2025 01:10:20 +0200 From: Alejandro Colomar To: Suren Baghdasaryan Cc: aarcange@redhat.com, lorenzo.stoakes@oracle.com, david@redhat.com, peterx@redhat.com, lokeshgidra@google.com, linux-man@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 1/1] man/man2/ioctl_userfaultfd.2, UFFDIO_MOVE.2const: Add UFFDIO_MOVE page Message-ID: <6kaeipedoa6vo4apmz7hb7cgozpl66w4f3z7sexunhqhsu3oda@von5awqj35if> References: <20250423195309.2841410-1-surenb@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7xuldjijayasuvkf" Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7079340009 X-Stat-Signature: xyjxq6oioxjhnznnc857cfjhrxy3tztd X-HE-Tag: 1746054626-932341 X-HE-Meta: U2FsdGVkX19IAF8TmG+gaG/PBaAg7tJF17cPJu68XnGCdjdIlWTJFs+SlVtBj99Z0rIOQwSucjgeOP1DIVtx+3t4kHogIcx2HnavniuQQCBbxi4OFlXe6QjEgUjChP8glbDDYgUYbKO7jXEFFlRtM52olGArfWpnRKY38euHtKsONvp3QZCoUQGFbWBySBPNA0RmSZ6/JJKHohMF2WB3F/5xegdFfhf9yUBcsQGDGgOcLPMBzE9w4D46f7th0fXCHKv0ecpyR1Sm5Zz091lZLRO2AOuEIPcYWU0NnwKmLe3z8Id0EU3IvRbCJTU7C+kl9IqCzE0K+5s7SElqDtnzY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h3xDsecYusChp+9U4ptrVpglu9CdOtiBS4tXxMUygJOl7LAEUDSk5cWQ2oF+4IHU+pPONO9jdGgwJMtdYP4bvph3Pari4TT7XI7gxFTuPQ== 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: List-Subscribe: List-Unsubscribe: --7xuldjijayasuvkf Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable From: Alejandro Colomar To: Suren Baghdasaryan Cc: aarcange@redhat.com, lorenzo.stoakes@oracle.com, david@redhat.com, peterx@redhat.com, lokeshgidra@google.com, linux-man@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 1/1] man/man2/ioctl_userfaultfd.2, UFFDIO_MOVE.2const: Add UFFDIO_MOVE page References: <20250423195309.2841410-1-surenb@google.com> MIME-Version: 1.0 In-Reply-To: Hi Suren, On Wed, Apr 30, 2025 at 03:59:42PM -0700, Suren Baghdasaryan wrote: > On Wed, Apr 23, 2025 at 12:53=E2=80=AFPM Suren Baghdasaryan wrote: > > > > Documentation was extracted from the original patch written by Andrea > > Arcangeli and upstreamed in [1]. Minor edits were made to maintain > > the same documentation style as other userfaultfd ioctl commands. > > > > [1] > > > > Signed-off-by: Suren Baghdasaryan > > --- > > Changes since v1[1] > > - removed '\" t, per Alejandro Colomar > > - reformated sentences to use semantic newlines, per Alejandro Colomar > > - changed field names to use '.' prefix, per Alejandro Colomar > > - changed EBUSY, UFFDIO_MOVE and MADV_DONTFORK to be bold, > > per Alejandro Colomar > > - folded duplicate information into EBUSY error description, > > per Alejandro Colomar >=20 > Hi Alex, > Haven't seen any feedback on this version so far. Is it ok to be > accepted or should I change anything else? > Thanks, > Suren. Sorry; I was traveling back to Spain the last few days. I'll have a look at it tomorrow. I had a quick look these days, and it looked good, but I'll confirm. Thanks! Have a lovely night! Alex >=20 > > > > [1] https://lore.kernel.org/all/20250423011203.2559210-1-surenb@google.= com/ > > > > man/man2/ioctl_userfaultfd.2 | 2 + > > man/man2const/UFFDIO_MOVE.2const | 153 +++++++++++++++++++++++++++++++ > > 2 files changed, 155 insertions(+) > > create mode 100644 man/man2const/UFFDIO_MOVE.2const > > > > diff --git a/man/man2/ioctl_userfaultfd.2 b/man/man2/ioctl_userfaultfd.2 > > index 3cb1b8305..5ec08ca55 100644 > > --- a/man/man2/ioctl_userfaultfd.2 > > +++ b/man/man2/ioctl_userfaultfd.2 > > @@ -69,6 +69,8 @@ events. > > .TQ > > .BR UFFDIO_COPY (2const) > > .TQ > > +.BR UFFDIO_MOVE (2const) > > +.TQ > > .BR UFFDIO_ZEROPAGE (2const) > > .TQ > > .BR UFFDIO_WAKE (2const) > > diff --git a/man/man2const/UFFDIO_MOVE.2const b/man/man2const/UFFDIO_MO= VE.2const > > new file mode 100644 > > index 000000000..77b0ca781 > > --- /dev/null > > +++ b/man/man2const/UFFDIO_MOVE.2const > > @@ -0,0 +1,153 @@ > > +.\" Written by Andrea Arcangeli > > +.\" > > +.\" SPDX-License-Identifier: Linux-man-pages-copyleft > > +.\" > > +.TH UFFDIO_MOVE 2const (date) "Linux man-pages (unreleased)" > > +.SH NAME > > +UFFDIO_MOVE > > +\- > > +atomically move a continuous memory chunk into the userfault registere= d range > > +.SH LIBRARY > > +Standard C library > > +.RI ( libc ,\~ \-lc ) > > +.SH SYNOPSIS > > +.nf > > +.BR "#include " " /* Definition of " UFFD* " con= stants */" > > +.B #include > > +.P > > +.BI "int ioctl(int " fd ", UFFDIO_MOVE, struct uffdio_move *" argp ); > > +.P > > +.B #include > > +.P > > +.fi > > +.EX > > +.B struct uffdio_move { > > +.BR " __u64 dst;" " /* Destination of move */" > > +.BR " __u64 src;" " /* Source of move */" > > +.BR " __u64 len;" " /* Number of bytes to move */" > > +.BR " __u64 mode;" " /* Flags controlling behavior of move */" > > +.BR " __s64 move;" " /* Number of bytes moved, or negated error *= /" > > +.B }; > > +.EE > > +.SH DESCRIPTION > > +Atomically move a continuous memory chunk > > +into the userfault registered range > > +and optionally wake up the blocked thread. > > +.P > > +The following value may be bitwise ORed in > > +.I .mode > > +to change the behavior of the > > +.B UFFDIO_MOVE > > +operation: > > +.TP > > +.B UFFDIO_MOVE_MODE_DONTWAKE > > +Do not wake up the thread that waits for page-fault resolution > > +.TP > > +.B UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES > > +Allow holes in the source virtual range that is being moved. > > +When not specified, the holes will result in > > +.B ENOENT > > +error. > > +When specified, > > +the holes will be accounted as successfully moved memory. > > +This is mostly useful > > +to move hugepage aligned virtual regions > > +without knowing if there are transparent hugepages in the regions or n= ot, > > +but preventing the risk of > > +having to split the hugepage during the operation. > > +.P > > +The > > +.I .move > > +field is used by the kernel > > +to return the number of bytes that was actually moved, > > +or an error > > +(a negated > > +.IR errno -style > > +value). > > +The > > +.I .move > > +field is output-only; > > +it is not read by the > > +.B UFFDIO_MOVE > > +operation. > > +.SH RETURN VALUE > > +On success, > > +0 is returned. > > +In this case, the entire area was moved. > > +.P > > +On error, \-1 is returned and > > +.I errno > > +is set to indicate the error. > > +.SH ERRORS > > +.TP > > +.B EAGAIN > > +The number of bytes moved (i.e., the value returned in the > > +.I .move > > +field) > > +does not equal the value that was specified in the > > +.I .len > > +field. > > +.TP > > +.B EINVAL > > +Either > > +.I .dst > > +or > > +.I .len > > +was not a multiple of the system page size, or the range specified by > > +.I .src > > +and > > +.I .len > > +or > > +.I .dst > > +and > > +.I .len > > +was invalid. > > +.TP > > +.B EINVAL > > +An invalid bit was specified in the > > +.I .mode > > +field. > > +.TP > > +.BR ENOENT > > +The source virtual memory range has unmapped holes and > > +.B UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES > > +is not set. > > +.TP > > +.BR EEXIST > > +The destination virtual memory range is fully or partially > > +mapped. > > +.TP > > +.BR EBUSY > > +The pages in the source virtual memory range are either > > +pinned or not exclusive to the process. > > +Once KSM deduplicates pages > > +or fork() COW-shares pages during fork() with child processes, > > +they are no longer exclusive. > > +The kernel might only perform lightweight checks > > +for detecting whether the pages are exclusive. > > +To make the operation more likely to succeed, > > +KSM should be disabled, > > +fork() should be avoided > > +or > > +.B MADV_DONTFORK > > +should be configured > > +for the source virtual memory area > > +before fork(). > > +.TP > > +.BR ENOMEM > > +Allocating memory needed for the operation failed. > > +.TP > > +.BR ESRCH > > +The target process has exited at the time of a > > +.B UFFDIO_MOVE > > +operation. > > +.SH STANDARDS > > +Linux. > > +.SH HISTORY > > +Linux 6.8. > > +.SH SEE ALSO > > +.BR ioctl (2), > > +.BR ioctl_userfaultfd (2), > > +.BR userfaultfd (2) > > +.P > > +.I linux.git/\:Documentation/\:admin\-guide/\:mm/\:userfaultfd.rst > > > > base-commit: 80e2715270fc05d5627c26f88e4c1ba8b093f510 > > -- > > 2.49.0.805.g082f7c87e0-goog > > >=20 --=20 --7xuldjijayasuvkf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmgSrdYACgkQ64mZXMKQ wqmS6g/9FkSyzrsh/wNoieBnzg6bCyZV3Rkz705hmaR2J9h0jNEhU0hSItPCsFjh wsK5FUef/m/pvD3dM6mb5VJGcm8SOHSSzrP4ARnty8JVD21yseNzwe/sNN+xdzhr QoyZu74paE6umduOO74yUM4x+uQHKrNY7+8osBCKiyu6qVlJSICW365UQMamnxRC P7+DzHiFjES9iDg+ni/WWhbZLuDyMMb/YocO93MsLL1HwAHZloFwUYm7SH+xkFmM pPnc+tQ6j6QO/uwXv3W7UgttOOM68KnYPV8Rb/NYo50BYKL3AgpHHfUDmeOzPF1Z 9jpVZpQa/X3GBYlBvnhU9XaIXo93zshj+yr2ZllfyMg/sKZ1iJWq4VqvWFmKakZK IIT0MtEaHH3rHJHSs3tNyrK7EZIfE91LmG6R88+BD1RhK6T+y4RHTpEdOFwwdfO2 o6dsNsV/0FwAsAsVFxImWIct7eXy9nQPdmBTLPXP7n/3iQyVIMBftJZDxNRfnswp NvV0RGgQOF5HyU1+cevBcrTPcgmdQ1DP/j2/IYlvUPvxRWYEFEkt83cbjzazwqzg hhaCLFHjCCKovpvzHbHjlQhjKSTPe2KITDoLqvZqIMbSdnyAJ2voTl5A2XHeoJJ/ LU6RstL9uaWMV1GXYWo0Z3jkk7IEjaqJzxZYWcXL+joYAm95BGQ= =tkMN -----END PGP SIGNATURE----- --7xuldjijayasuvkf--