Re: [PATCH bpf-next] bpf: Use max() instead of max_t()
From: Alexei Starovoitov
Date: Sat Jul 06 2024 - 17:14:57 EST
On Fri, Jul 5, 2024 at 10:14 PM Thorsten Blum <thorsten.blum@xxxxxxxxxx> wrote:
>
> Use max() instead of max_t(). The types are already compatible and don't
> need to be cast to u32 using max_t().
>
> Compile-tested only.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxxx>
> ---
> kernel/bpf/bpf_local_storage.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
> index 976cb258a0ed..f0a4f5c06b10 100644
> --- a/kernel/bpf/bpf_local_storage.c
> +++ b/kernel/bpf/bpf_local_storage.c
> @@ -779,7 +779,7 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
>
> nbuckets = roundup_pow_of_two(num_possible_cpus());
> /* Use at least 2 buckets, select_bucket() is undefined behavior with 1 bucket */
> - nbuckets = max_t(u32, 2, nbuckets);
> + nbuckets = max(2, nbuckets);
max_t is cleaner imo and u32 serves as documentation.
pw-bot: cr