Re: [PATCH RFC v2 13/20] x86: mm: carve out the generic compile-time folded pgtable case in effective_prot()

Yeoreum Yun <[email protected]> Wed, 22 Jul 2026 18:37:42 +0100
Newsgroups org.kernel.vger.linux-openrisc,dev.linux.lists.loongarch,org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips,org.kvack.linux-mm
Message-ID <[email protected]>
> On 7/22/26 08:30, Yeoreum Yun wrote:
> >  struct pg_state {
> >  	struct ptdump_state ptdump;
> > +	int first_level;
> >  	int level;
> >  	pgprotval_t current_prot;
> >  	pgprotval_t effective_prot;
> 
> There is zero reason on x86 to hold this value in a data structure. It
> is 100% determined at boot time or earlier. Pre-5-level-paging it's a
> compile-time constant.
> 
> On x86, it never varies per-mm.

However, mm_pXd_folded() requires to mm for other architecture like
s390. might save the mm instead of first_level and calls the
ptdump_pt_level_first() with static inline version would make the
constant comparison. So it requires to save *mm* structure in here.

[...]
-- 
Sincerely,
Yeoreum Yun