Re: [PATCH v7 5/6] tools/mm: make gup_bench a benchmark only tool

"David Hildenbrand (Arm)" <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kvack.linux-mm
Message-ID <[email protected]>
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) <[email protected]>
> Signed-off-by: Sarthak Sharma <[email protected]>
> ---


[...]

>  	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) <[email protected]>

-- 
Cheers,

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.