Re: [PATCH] arm64/mm: restrict transparent contpte mappings to valid PTEs
From: Catalin Marinas
Date: Mon Oct 26 2026 - 08:35:11 EST
On Sun, Oct 25, 2026 at 12:00:33AM +0800, Zhao Gongyi wrote:
> On 10/24/26 4:55 AM, David Hildenbrand (Arm) wrote:
> > If we have the spare PTE bit, why shouldn't we just use it?
> >
> > It will make batching over PTEs faster. And we care about that for present PTEs.
> >
> > So I don't quite see why the stable fix couldn't just do it right away? Do you
> > have a prototype that shows that it would require significant code changes?
>
> I tried a small prototype that keeps PTE_CONT on present-invalid PTEs.
> It leaves contpte_set_ptes() unchanged and makes contpte_try_unfold()
> recognize pte_present(pte) && pte_cont(pte), instead of checking only
> pte_valid_cont(pte).
I think it's worth doing but currently not sure it buys us much unless
we also change pte_batch_hint() to cover such entries. However, if we do
this, we need to audit the other pte_valid_cont() callers (e.g.
ptep_get() needs updating as well).
So, if we aren't going to change pte_batch_hint() as a backport fix (I
don't think we should, it's an optimisation), I'd rather take v2 now and
continue with a proper pte_present_cont() etc. patchset on top.
--
Catalin