[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250407112922.17766-1-ioworker0@gmail.com>
Date: Mon, 7 Apr 2025 19:29:22 +0800
From: Lance Yang <ioworker0@...il.com>
To: xavier_qy@....com
Cc: akpm@...ux-foundation.org,
baohua@...nel.org,
catalin.marinas@....com,
ioworker0@...il.com,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
ryan.roberts@....com,
will@...nel.org
Subject: Re: [PATCH v1] mm/contpte: Optimize loop to reduce redundant operations
Thanks for the patch. Would the following change be better?
diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c
index 55107d27d3f8..64eb3b2fbf06 100644
--- a/arch/arm64/mm/contpte.c
+++ b/arch/arm64/mm/contpte.c
@@ -174,6 +174,9 @@ pte_t contpte_ptep_get(pte_t *ptep, pte_t orig_pte)
if (pte_young(pte))
orig_pte = pte_mkyoung(orig_pte);
+
+ if (pte_young(orig_pte) && pte_dirty(orig_pte))
+ break;
}
return orig_pte;
--
We can check the orig_pte flags directly instead of using extra boolean
variables, which gives us an early-exit when both dirty and young flags
are set.
Also, is this optimization really needed for the common case?
Thanks,
Lance
Powered by blists - more mailing lists