Re: [PATCH v7 5/6] tools/mm: make gup_bench a benchmark only tool
From: Sarthak Sharma
Date: Tue Aug 25 2026 - 04:46:42 EST
Hi David!
On 8/24/26 6:07 PM, David Hildenbrand (Arm) wrote:
> 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.
Makes sense. Will make this change.
>
>
> Apart from that
>
> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Thank you!