mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
To: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Mike Rapoport <rppt@kernel.org>,
	David Hildenbrand <david@kernel.org>,
	 Jonathan Corbet <corbet@lwn.net>, Peter Xu <peterx@redhat.com>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-mm@kvack.org,  linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tal Zussman <tz2294@columbia.edu>,
	 Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v2] Documentation/userfaultfd: document RWP behavior when the PTE is dropped
Date: Mon, 16 Nov 2026 16:28:49 +0000	[thread overview]
Message-ID: <avsu-yTSPKtZn_Ez@shutemov.name> (raw)
In-Reply-To: <20261116101004.15322-1-azpijr@gmail.com>

On Mon, Nov 16, 2026 at 11:09:56AM +0100, Jose A. Perez de Azpillaga wrote:
> +The registration is fixed, but the tracking mode is not: a context that
> +switches to sync mode with ``UFFDIO_SET_MODE``, as the workflow below does,
> +needs the sync registration. This has a cost in async mode, because minor
> +faults are always synchronous: an access that takes a minor fault blocks
> +until the handler resolves it, even while RWP faults are resolved by the
> +kernel.

Nitpick, and my fault: I said in v1 that the registration is fixed. It
is not. UFFDIO_REGISTER on an already registered range with the same
context can add or drop MISSING and MINOR; only dropping WP or RWP needs
an unregister first. So the cost in async mode is optional: the VMM can
add MINOR before it switches to sync and drop it after it switches back.

Maybe something like:

  The registration does not follow the tracking mode: a context that
  switches to sync mode with ``UFFDIO_SET_MODE``, as the workflow below
  does, needs ``UFFDIO_REGISTER_MODE_MINOR`` while it is in sync mode.
  Minor faults are always synchronous, so keeping it registered makes
  them block in async mode as well. Re-registering the range to add
  ``UFFDIO_REGISTER_MODE_MINOR`` before switching to sync, and to drop
  it after switching back, avoids that.

The example can stay as it is.

Otherwise:

Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

      reply	other threads:[~2026-11-16 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 10:09 Jose A. Perez de Azpillaga
2026-11-16 16:28 ` Kiryl Shutsemau (Meta) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avsu-yTSPKtZn_Ez@shutemov.name \
    --to=kas@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=azpijr@gmail.com \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=peterx@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=rppt@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tz2294@columbia.edu \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®