Re: Suppress pte soft-dirty bit with UFFDIO_COPY?

Axel Rasmussen <[email protected]>
Newsgroups dev.linux.lists.criu,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <CAJHvVcjLecujsDCQ2AK89C5HJ7LLYc8ez1VEpG5m9yP8eJtnHg@mail.gmail.com>
On Tue, May 13, 2025 at 6:25 AM Peter Xu <[email protected]> wrote:
>
> On Mon, May 12, 2025 at 10:16:12AM -0700, Kyle Huey wrote:
> > Personally I don't think it's a real issue to have to create a
> > sacrificial fd once at process initialization to see what features are
> > available. I wouldn't have even said anything if the man page hadn't
> > explicitly told me there was another way.
>
> Yes, that's indeed the part that could be confusing and needs fixing.  Just
> to keep a record (I have you copied), I sent the man-pages changes here:
>
> https://lore.kernel.org/r/[email protected]

Agreed, at a high level I think this is the right fix. I believe I
just forgot the probing required a separate FD when I wrote that
version of the man page. :)

>
> We can stick with the sacrificial fd until there's a solid clue showing
> that we should introduce a new way to probe.

For what it's worth, I'm still convinced the whole handshake / probing
thing is overcomplicated, and it would be simpler to just do:

1. Userspace asks for the features it wants (UFFDIO_API)
2. Kernel responds (fills in the struct) with the (possibly subset) of
features it supports
3. Userspace can react as it sees fit if it gets a subset (fail with
error, gracefully degrade, ...)

But, based on previous discussion of that I believe I'm in the minority. :)

If we are sticking with the handshake approach, I agree needing a
second uffd is no big deal. We could add an ioctl to just probe
without configuring, but that would purely be for convenience, and I
don't think it saves many lines of code in userspace. So, on balance /
considering the small benefit I would probably prefer keeping the
kernel simpler.

>
> Thanks,
>
> --
> Peter Xu
>

On Tue, May 13, 2025 at 6:25 AM Peter Xu <[email protected]> wrote:
>
> On Mon, May 12, 2025 at 10:16:12AM -0700, Kyle Huey wrote:
> > Personally I don't think it's a real issue to have to create a
> > sacrificial fd once at process initialization to see what features are
> > available. I wouldn't have even said anything if the man page hadn't
> > explicitly told me there was another way.
>
> Yes, that's indeed the part that could be confusing and needs fixing.  Just
> to keep a record (I have you copied), I sent the man-pages changes here:
>
> https://lore.kernel.org/r/[email protected]
>
> We can stick with the sacrificial fd until there's a solid clue showing
> that we should introduce a new way to probe.
>
> Thanks,
>
> --
> Peter Xu
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.