On Sat, 12 Apr 2025 22:36:56 +0800
Menglong Dong <[email protected]> wrote:

> > Yeah, this seems to make more sense. And I'll send a V2
> > later.
> >
> > BTW, Should we still keep the "size = min(size, 32)" logic  
> 
> Oops, I mean "size =  max(size, 32); size = fls(size);" here :/
> 
> > to avoid the hash bits being too small, just like the origin
> > logic in "dup_hash"?
> >

If you have 5 functions, why do you need more that 5 buckets?

        size = 5;
        size = max(5, 32); // size = 32
        size = fls(size); // size = 5
        alloc_ftrace_hash(size);

                size = 1 << size; // size = 32
                hash->buckets = kcalloc(size, ...);

Now you have 32 buckets for 5 functions. Why waste the memory?

If you add more functions, the hash bucket size will get updated.

-- Steve

Reply via email to