lkml.org 
[lkml]   [2023]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] mm: userfaultfd: add UFFDIO_CONTINUE_MODE_WP to install WP PTEs
    On Tue, Feb 14, 2023 at 07:32:29PM -0500, Peter Xu wrote:
    > On Tue, Feb 14, 2023 at 02:37:51PM -0800, Axel Rasmussen wrote:
    > > Agreed, it would likely be a nice cleanup. Peter, any objections? I
    > > wouldn't mind writing a commit to do this sort of refactor, and rebase
    > > my change on top of that.
    >
    > No objection here. Personally I actually prefer keeping the parameters
    > around if possible because it's straightforward and no thinking of any
    > possible indirect accesses all over the place. But maybe growing as long as
    > 8 is still a moot point.. It's just that I don't really know whether it'll
    > look that good if we put everything into a struct*.
    >
    > Things like src_start/dst_start/.. do not look good to be there: each layer
    > could loop over its own range of start/end/... so even if not in the
    > function parameter we'll need a variable to hold them anyway.
    >
    > But I do see a few low hanging fruits:
    >
    > - I don't see why we need to pass over mmap_changing over all of the
    > __mcopy_atomic() callers. One chance is we simply pass in the ctx* to
    > replace "dst_mm + mmap_changing".

    Now ctx* is completely private to fs/userfaultfd.c and I think it'd be
    better to keep it this way.

    > - Merge mcopy_atomic_mode and mode, having last 2 bits for the existing
    > three modes, then bit 3 for WP, good enough to set it for the new case.

    Agree, having flags instead of an enum and bools sounds better to me.

    > - Optionally, we can avoid passing over dst_mm/src_mm all around, when
    > dst_vma/src_vma is there?

    +1

    > How about we start from simple?
    >
    > --
    > Peter Xu
    >

    --
    Sincerely yours,
    Mike.

    \
     
     \ /
      Last update: 2023-03-27 00:23    [W:2.571 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site