[External] Re: [PATCH] malloc: fix malloc performance may becomes worse as the number of malloc increases

Fengnan Chang changfengnan at bytedance.com
Thu Feb 16 03:54:35 CET 2023


Stephen Hemminger <stephen at networkplumber.org> 于2023年2月16日周四 01:16写道:
>
> On Wed, 15 Feb 2023 12:10:23 +0100
> Morten Brørup <mb at smartsharesystems.com> wrote:
>
> > Looking isolated at the patch itself...
> >
> > I agree with the way the patch modifies the ranges of the free list, and the consequential removal of the "- 1" from the calculation of log2.
> >
> > Intuitively, the lists should cover ranges such as [0x100..0x3FF], which this patch does, not [0x101..0x400], how it was previously... The ranges with this patch make much more sense.
> >
> > So if the existing code is otherwise correct, i.e. handles the size with/without MALLOC_ELEM_HEADER_LEN correctly, my gut feeling says this patch is an improvement.
> >
> > Acked-by: Morten Brørup <mb at smartsharesystems.com>
>
> It would be good to have a malloc performance test.
> Possibly something reused from some other project.

I have done some performance tests in SPDK before,maybe available for
your reference:

https://bytedance.feishu.cn/wiki/wikcnKWXQmN4qhyxLcWJqP4vrOs

In one word, the performance of 4k malloc has improved, and other
cases almost the same.


More information about the dev mailing list