Re: [PATCH 2/3] mm: Call arch_swap_restore() from arch_do_swap_page() and deprecate the latter

From: David Hildenbrand
Date: Fri May 12 2023 - 23:35:25 EST


On 13.05.23 01:57, Peter Collingbourne wrote:
The previous patch made it possible for MTE to restore tags before they
are freed by hooking arch_do_swap_page().

However, the arch_do_swap_page() hook API is incompatible with swap
restoration in circumstances where we do not have an mm or a vma,
such as swapoff with swapped out shmem, and I expect that ADI will
currently fail to restore tags in these circumstances. This implies that
arch-specific metadata stores ought to be indexed by swap index, as MTE
does, rather than by mm and vma, as ADI does, and we should discourage
hooking arch_do_swap_page(), preferring to hook arch_swap_restore()
instead, as MTE already does.

Therefore, instead of directly hooking arch_do_swap_page() for
MTE, deprecate that hook, change its default implementation to call
arch_swap_restore() and rely on the existing implementation of the latter
for MTE.

Fixes: c145e0b47c77 ("mm: streamline COW logic in do_swap_page()")

Can you enlighten me how this change fixes that commit? I'm afraid I am missing something important.

What is the user-visible impact of the problem, how was it caused by c145e0b47c77, and how does your change fix it?

--
Thanks,

David / dhildenb