Re: [PATCH 2/4] mm: Add arch hooks for saving/restoring tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/04/2020 10:09, Catalin Marinas wrote:
On Wed, Apr 22, 2020 at 11:08:10AM -0700, Dave Hansen wrote:
On 4/22/20 7:25 AM, Steven Price wrote:
Three new hooks are added to the swap code:
  * arch_prepare_to_swap() and
  * arch_swap_invalidate_page() / arch_swap_invalidate_area().
One new hook is added to shmem:
  * arch_swap_restore_tags()

How do the tags get restored outside of the shmem path?  I was expecting
to see more arch_swap_restore_tags() sites.

The restoring is done via set_pte_at() -> mte_sync_tags() ->
mte_restore_tags() in the arch code (see patch 3).
arch_swap_restore_tags() just calls mte_restore_tags() directly.

shmem is slightly problematic as it moves the page from the swap cache
to the shmem one and I think arch_swap_invalidate_page() would have
already been called by the time we get to set_pte_at() (Steven can
correct me if I got this wrong).

That's correct - shmem can pull in pages (into it's own cache) and invalidate the swap entries without any process having a PTE restored. So we need to hook shmem to restore the tags even though there's no PTE restored yet.

The set_pte_at() 'trick' enables delaying the restoring of the tags (in the usual case) until the I/O for the page has completed, which might be necessary in some cases if the I/O can clobber the tags in memory. I couldn't find a better way of hooking this.

Steve




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux