[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+woHZ3AHe3quadT@x1n>
Date: Tue, 14 Feb 2023 19:32:29 -0500
From: Peter Xu <peterx@...hat.com>
To: Axel Rasmussen <axelrasmussen@...gle.com>
Cc: 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>,
Mike Rapoport <rppt@...nel.org>, 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 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".
- 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.
- Optionally, we can avoid passing over dst_mm/src_mm all around, when
dst_vma/src_vma is there?
How about we start from simple?
--
Peter Xu
Powered by blists - more mailing lists