Thread (11 messages) 11 messages, 3 authors, 2023-05-19

Re: [PATCH 1/3] mm: Move arch_do_swap_page() call to before swap_free()

From: Peter Collingbourne <hidden>
Date: 2023-05-18 20:06:28
Also in: linux-mm, lkml, stable

Possibly related (same subject, not in this thread)

On Wed, May 17, 2023 at 1:30 AM David Hildenbrand [off-list ref] wrote:
quoted
quoted
Would the idea be to fail swap_readpage() on the one that comes last,
simply retrying to lookup the page?
The idea would be that T2's arch_swap_readpage() could potentially not
find tags if it ran after swap_free(), so T2 would produce a page
without restored tags. But that wouldn't matter, because T1 reaching
swap_free() means that T2 will follow the goto at [1] after waiting
for T1 to unlock at [2], and T2's page will be discarded.
Ah, right.
quoted
quoted
This might be a naive question, but how does MTE play along with shared
anonymous pages?
It should work fine. shmem_writepage() calls swap_writepage() which
calls arch_prepare_to_swap() to write the tags. And
shmem_swapin_folio() has a call to arch_swap_restore() to restore
them.
Sorry, I meant actual anonymous memory pages, not shmem. Like, anonymous
pages that are COW-shared due to fork() or KSM.

How does MTE, in general, interact with that? Assume one process ends up
modifying the tags ... and the page is COW-shared with a different
process that should not observe these tag modifications.
Tag modifications cause write faults if the page is read-only, so for
COW shared pages we would end up copying the page in the usual way,
which on arm64 would copy the tags as well via the copy_highpage hook
(see arch/arm64/mm/copypage.c).

Peter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help