LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Xu <email@example.com>
To: Alistair Popple <firstname.lastname@example.org>
Andrew Morton <email@example.com>,
Hugh Dickins <firstname.lastname@example.org>,
email@example.com, Miaohe Lin <firstname.lastname@example.org>,
David Hildenbrand <email@example.com>,
Andrea Arcangeli <firstname.lastname@example.org>,
Yang Shi <email@example.com>,
Matthew Wilcox <firstname.lastname@example.org>,
"Kirill A . Shutemov" <email@example.com>,
Jerome Glisse <firstname.lastname@example.org>,
Liam Howlett <email@example.com>,
Mike Rapoport <firstname.lastname@example.org>
Subject: Re: [PATCH v3 5/5] mm: Add ZAP_FLAG_SKIP_SWAP and zap_flags
Date: Tue, 14 Sep 2021 22:52:48 -0400 [thread overview]
Message-ID: <YUFgAPJJxy8L4GMP@xz-m1.local> (raw)
On Wed, Sep 15, 2021 at 12:25:07PM +1000, Alistair Popple wrote:
> On Thursday, 9 September 2021 2:36:28 AM AEST Peter Xu wrote:
> > Firstly, the comment in zap_pte_range() is misleading because it checks against
> > details rather than check_mappings, so it's against what the code did.
> > Meanwhile, there's no explicit reason why passing in the details pointer should
> > mean to skip all swap entries. New user of zap_details could very possibly
> > miss this fact if they don't read deep until zap_pte_range() because there's no
> > comment at zap_details talking about it at all, so swap entries could be
> > erroneously skipped without being noticed.
> > This partly reverts 3e8715fdc03e ("mm: drop zap_details::check_swap_entries"),
> > but introduce ZAP_FLAG_SKIP_SWAP flag, which means the opposite of previous
> > "details" parameter: the caller should explicitly set this to skip swap
> > entries, otherwise swap entries will always be considered (which should still
> > be the major case here).
> > We may want to look into when exactly we need ZAP_FLAG_SKIP_SWAP and we should
> > have it in a synchronous manner, e.g., currently even if ZAP_FLAG_SKIP_SWAP is
> > set we'll still look into swap pmds no matter what. But that should be a
> > separate effort of this patch.
> I didn't really follow what you mean by "synchronous" here, although the
> explanation about pmds makes sense so it's probably just terminology.
Yes, maybe I should use "aligned manner", or please suggest anything that
sounds better; sorry for my awkward English.
> > The flag introduced in this patch will be a preparation for more bits defined
> > in the future, e.g., for a new bit in flag to show whether to persist the
> > upcoming uffd-wp bit in pgtable entries.
> That's kind of the problem. The patch itself looks correct to me however as
> mentioned it is mostly reverting a previous cleanup and it's hard to tell why
> that's justified without the subsequent patches. Perhaps it makes the usage of
> zap_details a bit clearer, but a comment also would with less code.
> I know you want to try and shrink the uffd-wp series but I think this patch
> might be easier to review if it was included as part of that series.
I posted it because I think it's suitable to have it even without uffd-wp.
I tried to explain it above on two things this patch wanted to fix:
Firstly the comment is wrong; we've moved back and forth on changing the
zap_details flags but the comment is not changing along the way and it's not
matching the code right now.
Secondly I do think we should have a flag showing explicit willingness to skip
swap entries. Yes, uffd-wp is the planned new one, but my point is anyone who
will introduce a new user of zap_details pointer could overlook this fact. The
new flag helps us to make sure someone will at least read the flags and know
what'll happen with it.
For the 2nd reasoning, I also explicitly CCed Kirill too, so Kirill can provide
any comment if he disagrees. For now, I still think we should keep having such
a flag otherwise it could be error-prone.
Could you buy-in above reasoning?
Basically above is what I wanted to express in my commit message. I hope that
can justify that this patch (even if extremly simple) can still be considered
as acceptable upstream even without uffd-wp series.
If you still insist on this patch not suitable for standalone merging and
especially if some other reviewer would think the same, I can move it back to
uffd-wp series for sure. Then I'll repost this series with 4 patches only.
In all cases, thanks for looking at the series.
next prev parent reply other threads:[~2021-09-15 2:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 16:35 [PATCH v3 0/5] mm: A few cleanup patches around zap, shmem and uffd Peter Xu
2021-09-08 16:35 ` [PATCH v3 1/5] mm/shmem: Unconditionally set pte dirty in mfill_atomic_install_pte Peter Xu
2021-09-08 16:36 ` [PATCH v3 2/5] mm: Clear vmf->pte after pte_unmap_same() returns Peter Xu
2021-09-08 16:36 ` [PATCH v3 3/5] mm: Drop first_index/last_index in zap_details Peter Xu
2021-09-09 2:54 ` Liam Howlett
2021-09-09 18:13 ` Peter Xu
2021-09-08 16:36 ` [PATCH v3 4/5] mm: Add zap_skip_check_mapping() helper Peter Xu
2021-09-09 1:16 ` Alistair Popple
2021-09-08 16:36 ` [PATCH v3 5/5] mm: Add ZAP_FLAG_SKIP_SWAP and zap_flags Peter Xu
2021-09-15 2:25 ` Alistair Popple
2021-09-15 2:52 ` Peter Xu [this message]
2021-09-15 3:21 ` Alistair Popple
2021-09-15 4:01 ` Peter Xu
2021-09-14 16:37 ` [PATCH v3 0/5] mm: A few cleanup patches around zap, shmem and uffd Peter Xu
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--subject='Re: [PATCH v3 5/5] mm: Add ZAP_FLAG_SKIP_SWAP and zap_flags' \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).