Re: [PATCH v2 1/1] s390/mm: Fix handling of _PAGE_UNUSED pte bit

From: Alexander Gordeev

Date: Mon Jun 15 2026 - 12:04:10 EST


On Mon, Jun 15, 2026 at 11:17:41AM +0200, Claudio Imbrenda wrote:
> @@ -122,6 +122,8 @@ pte_t ptep_xchg_direct(struct mm_struct *mm, unsigned long addr,
>
> preempt_disable();
> old = ptep_flush_direct(mm, addr, ptep, 1);
> + if (pte_present(new))
> + new = clear_pte_bit(new, __pgprot(_PAGE_UNUSED));

Why not before preempt_disable()?

> set_pte(ptep, new);
> preempt_enable();
> return old;
> @@ -160,6 +162,8 @@ pte_t ptep_xchg_lazy(struct mm_struct *mm, unsigned long addr,
>
> preempt_disable();
> old = ptep_flush_lazy(mm, addr, ptep, 1);
> + if (pte_present(new))
> + new = clear_pte_bit(new, __pgprot(_PAGE_UNUSED));

Same here.

> set_pte(ptep, new);
> preempt_enable();
> return old;