Re: [PATCH v3 03/11] s390/mm/gmap: Refactor gmap_fault() and add support for pfault

From: Heiko Carstens
Date: Mon Oct 21 2024 - 05:42:08 EST


On Tue, Oct 15, 2024 at 06:43:18PM +0200, Claudio Imbrenda wrote:
> When specifying FAULT_FLAG_RETRY_NOWAIT as flag for gmap_fault(), the
> gmap fault will be processed only if it can be resolved quickly and
> without sleeping. This will be needed for pfault.
>
> Refactor gmap_fault() to improve readability.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> Acked-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
> ---
> arch/s390/mm/gmap.c | 119 +++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 100 insertions(+), 19 deletions(-)
...

> +static int fixup_user_fault_nowait(struct mm_struct *mm, unsigned long address,
> + unsigned int fault_flags, bool *unlocked)
> +{
> + struct vm_area_struct *vma;
> + unsigned int test_flags;
> + vm_fault_t fault;
> + int rc;
> +
> + fault_flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT;
^^^^^^^^^^^^^^^^^^^^^^^

This is not necessary, because of

> + if (fault_flags & FAULT_FLAG_RETRY_NOWAIT) {
> + rc = fixup_user_fault_nowait(gmap->mm, vmaddr, fault_flags, &unlocked);

this.

In any case:
Reviewed-by: Heiko Carstens <hca@xxxxxxxxxxxxx>