[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y+x9tx8faNzvZAug@kernel.org>
Date: Wed, 15 Feb 2023 08:37:43 +0200
From: Mike Rapoport <rppt@...nel.org>
To: Peter Xu <peterx@...hat.com>
Cc: Axel Rasmussen <axelrasmussen@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Mike Kravetz <mike.kravetz@...cle.com>,
Muchun Song <muchun.song@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>, Shuah Khan <shuah@...nel.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Nadav Amit <namit@...are.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org,
James Houghton <jthoughton@...gle.com>
Subject: Re: [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.
Powered by blists - more mailing lists