From: Anshuman Khandual <anshuman.khandual@arm.com>
To: David Hildenbrand <david@redhat.com>,
linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Ryan Roberts <ryan.roberts@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC 0/4] arm64/mm: Clean up pte_dirty() state management
Date: Mon, 10 Jul 2023 07:50:30 +0530 [thread overview]
Message-ID: <60732ee3-f1c5-3534-29fc-783ec48f2c92@arm.com> (raw)
In-Reply-To: <b8bf72f4-f590-a159-ca94-526153b73216@redhat.com>
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))
But then falls short in demonstrating how these two states are being managed i.e
created and cleared. The first patch tries to clear the situation to some extent.
>
> Maybe there are other opinions, but at least for me this made the code harder to grasp.
>
> I do appreciate a doc update, though :)
These two changes also streamline HW dirty bit saving in SW dirty bit efficiently,
skipping the re-doing of HW dirty bits setting which might be cleared off. That is
the primary reason for saving it off in SW dirty bit in the first place.
arm64/mm: Call pte_sw_mkdirty() while preserving the HW dirty state
arm64/mm: Add pte_preserve_hw_dirty(
Regardless, I am still trying to understand how the first patch does not improve
the clarity in modifying the PTE dirty state.
next prev parent reply other threads:[~2023-07-10 2:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 5:33 Anshuman Khandual
2023-07-07 5:33 ` [RFC 1/4] arm64/mm: Add SW and HW dirty state helpers Anshuman Khandual
2023-07-07 12:09 ` David Hildenbrand
2023-07-10 2:54 ` Anshuman Khandual
2023-07-07 5:33 ` [RFC 2/4] arm64/mm: Call pte_sw_mkdirty() while preserving the HW dirty state Anshuman Khandual
2023-07-07 5:33 ` [RFC 3/4] arm64/mm: Add pte_preserve_hw_dirty() Anshuman Khandual
2023-07-07 5:33 ` [RFC 4/4] docs: arm64: Add help document for pte dirty state management Anshuman Khandual
2023-07-07 12:11 ` [RFC 0/4] arm64/mm: Clean up pte_dirty() " David Hildenbrand
2023-07-10 2:20 ` Anshuman Khandual [this message]
2023-07-10 9:17 ` David Hildenbrand
2023-07-10 11:25 ` Mark Rutland
2023-07-12 4:01 ` Anshuman Khandual
2023-07-16 15:10 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60732ee3-f1c5-3534-29fc-783ec48f2c92@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®