On 10.07.23 04:20, Anshuman Khandual wrote:
On 7/7/23 17:41, David Hildenbrand wrote:
On 07.07.23 07:33, 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.
I skimmed over most of the series, and I am not convinced that this is actually a cleanup. If we cannot really always differentiate between sw/hw clearing, why have separate primitives that give one the illusion that it could be done and that they are two different concepts?
These are indeed two different concepts working together, the current code just
obscures that. Without these primitives it's even hard to follow how the SW and
HW dirty parts are intertwined in implementing the generic pte_dirty() state.
The current code acknowledges these two different concepts in identifying them
i.e via pte_hw_dirty() and pte_sw_dirty().
#define pte_hw_dirty(pte) (pte_write(pte) && !(pte_val(pte) & PTE_RDONLY))
#define pte_sw_dirty(pte) (!!(pte_val(pte) & PTE_DIRTY))
^ these primitives make sense to me, but not the clearing part.
If there is only one way to clear both, then only have one primitive to
clear both and state there, that separate clearing is impossible because
both are intertwined.
--
Cheers,
David / dhildenb