Re: [PATCH v2 1/1] s390/mm: Fix handling of _PAGE_UNUSED pte bit
From: Heiko Carstens
Date: Mon Jun 15 2026 - 07:51:24 EST
On Mon, Jun 15, 2026 at 12:31:03PM +0200, Claudio Imbrenda wrote:
> On Mon, 15 Jun 2026 11:43:00 +0200
> Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:
>
> [...]
>
> > > @@ -175,6 +179,8 @@ pte_t ptep_modify_prot_start(struct
> vm_area_struct *vma, unsigned long addr,
> > > void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
> > > pte_t *ptep, pte_t old_pte, pte_t pte)
> > > {
> > > + if (pte_present(pte))
> > > + pte = clear_pte_bit(pte, __pgprot(_PAGE_UNUSED));
> > > set_pte(ptep, pte);
> >
> > Can't we move the logic from set_ptes() to set_pte() instead? The above
>
> set_pte() is also used for things that are not ptes, and in those cases
> we probably don't want to touch that bit, although technically it is
> currently unused for present large pmds and puds.
I can only see huge_pte_clear() for this.
If that's the only user I'd rather add a BUG_ON() there instead of starting to
sprinkle the logic around. This _will_ break sooner or later.