Re: [PATCH v9 01/14] mm: x86, arm64: add arch_has_hw_pte_young()
From: Yu Zhao <hidden>
Date: 2022-03-11 23:02:20
Also in:
linux-doc, linux-mm, lkml
On Fri, Mar 11, 2022 at 3:55 AM Barry Song [off-list ref] wrote:
On Wed, Mar 9, 2022 at 3:47 PM Yu Zhao [off-list ref] wrote:quoted
Some architectures automatically set the accessed bit in PTEs, e.g., x86 and arm64 v8.2. On architectures that do not have this capability, clearing the accessed bit in a PTE usually triggers a page fault following the TLB miss of this PTE (to emulate the accessed bit). Being aware of this capability can help make better decisions, e.g., whether to spread the work out over a period of time to reduce bursty page faults when trying to clear the accessed bit in many PTEs. Note that theoretically this capability can be unreliable, e.g., hotplugged CPUs might be different from builtin ones. Therefore it should not be used in architecture-independent code that involves correctness, e.g., to determine whether TLB flushes are required (in combination with the accessed bit). Signed-off-by: Yu Zhao <redacted> Acked-by: Brian Geffon <redacted> Acked-by: Jan Alexander Steffens (heftig) <redacted> Acked-by: Oleksandr Natalenko <redacted> Acked-by: Steven Barrett <redacted> Acked-by: Suleiman Souhlal <redacted> Acked-by: Will Deacon <will@kernel.org> Tested-by: Daniel Byrne <redacted> Tested-by: Donald Carr <redacted> Tested-by: Holger Hoffstätte <redacted> Tested-by: Konstantin Kharlamov <redacted> Tested-by: Shuang Zhai <redacted> Tested-by: Sofia Trinh <redacted> Tested-by: Vaibhav Jain <redacted> ---Reviewed-by: Barry Song <baohua@kernel.org>
Thanks.
i guess arch_has_hw_pte_young() isn't called that often in either mm/memory.c or mm/vmscan.c. Otherwise, moving to a static key might help. Is it?
MRS shouldn't be slower than either branch of a static key. With a static key, we only can optimize one of the two cases. There is a *theoretical* problem with MRS: ARM specs don't prohibit a physical CPU to support both cases (on different logical CPUs). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel