Re: [RFC PATCH v3 1/3] mm: make persistent huge zero folio read-only

From: Xueyuan Chen

Date: Thu Jul 09 2026 - 23:05:42 EST



On Tue, Jul 07, 2026 at 06:17:12AM -0700, Usama Arif wrote:

Hi Usama,

Sorry for the late reply.

[...]

>Can this really skip the TLB flush here? This runs from a
>subsys_initcall, after smp_init() and after the folio was allocated and
>zeroed through the writable direct map. The noflush helper updates the
>direct-map PTEs but does not invalidate stale writable kernel TLB entries.
>
>I think we need a TLB flush here?

I checked the code, and you are right. This runs after smp_init(), and
the folio has already been allocated and zeroed through the writable
direct map before changing the direct-map PTEs. So skipping the TLB
flush is not safe.

I will fix this in the next version.

Thanks for catching this.

Thanks,
Xueyuan