Re: [PATCH v7 5/6] tools/mm: make gup_bench a benchmark only tool
From: David Hildenbrand (Arm)
Date: Mon Aug 24 2026 - 08:39:01 EST
On 8/13/26 20:12, Sarthak Sharma wrote:
> Remove the functional modes (GUP_BASIC_TEST, PIN_BASIC_TEST and
> DUMP_USER_PAGES_TEST) from gup_bench. Drop the kselftest dependency
> and use normal diagnostics and exit statuses.
>
> When no arguments are supplied, run a single GUP_FAST_BENCHMARK
> with the existing default values. Let users select other
> configurations through command-line options. Report ioctl failures
> and handle errors without relying on assert().
>
> Suggested-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Signed-off-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>
> ---
[...]
> free(tid);
>
> - ksft_exit_pass();
> + if (thread_error)
> + goto err_unmap;
> +
> + munmap((void *)gup.addr, size);
> + close(gup_fd);
> + close(filed);
> + return 0;
> +
> +err_unmap:
> + munmap((void *)gup.addr, size);
> +err_close_gup_fd:
> + close(gup_fd);
> +err_close_filed:
> + close(filed);
> + return 1;
> }
Why not have a "int ret = 1;" and just befor ethe err_unmap, do ret = 0;
That way you avoid the duplicate exit code.
Apart from that
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David