Re: [RFC 0/4] arm64/mm: Clean up pte_dirty() state management

From: Mark Rutland
Date: Mon Jul 10 2023 - 07:25:13 EST


On Fri, Jul 07, 2023 at 11:03:27AM +0530, Anshuman Khandual wrote:
> These pte_dirty() changes make things explicitly clear, while improving the
> code readability. This optimizes HW dirty state transfer into SW dirty bit.
> This also adds a new arm64 documentation explaining overall pte dirty state
> management in detail. This series applies on the latest mainline kernel.

TBH, I think this is all swings and roundabouts, and I'm not sure this is
worthwhile. I appreciate that as-is some people find this confusing, but I
don't think the end result of this series is actually better, and it adds more
code/documentation to maintain.

In particular, I don't think that we should add Documentation/ files for this,
as it's very likely that won't be updated together with the code, and I think
it's more of a maintenance burden than a help. If we want some introductory
text to explain how the HW/SW dirty bits work, I think that should be a comment
block in <asm/pgtable.h>, clearly associated with the code.

Overall, I'd prefer to leave the code as-is.

Thanks,
Mark.

>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Jonathan Corbet <corbet@xxxxxxx>
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-doc@xxxxxxxxxxxxxxx
>
> Anshuman Khandual (4):
> arm64/mm: Add SW and HW dirty state helpers
> arm64/mm: Call pte_sw_mkdirty() while preserving the HW dirty state
> arm64/mm: Add pte_preserve_hw_dirty()
> docs: arm64: Add help document for pte dirty state management
>
> Documentation/arch/arm64/index.rst | 1 +
> Documentation/arch/arm64/pte-dirty.rst | 95 ++++++++++++++++++++++++++
> arch/arm64/include/asm/pgtable.h | 66 ++++++++++++++----
> 3 files changed, 147 insertions(+), 15 deletions(-)
> create mode 100644 Documentation/arch/arm64/pte-dirty.rst
>
> --
> 2.30.2
>