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

Yeoreum Yun yeoreum.yun at arm.com
Wed Jul 22 10:37:42 PDT 2026


> 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



More information about the linux-riscv mailing list