[LTP] [PATCH v1 2/3] syscalls/mallinfo02: Add a basic test to check use mmap or sbrk

Yang Xu
2021-02-04T09:53:16Z

Hi Li
> Hi Xu,
>
> Yang Xu <xuyang2018.jy@cn.fujitsu.com
> <mailto:xuyang2018.jy@cn.fujitsu.com>> wrote:
>
> ...
>
> So I use this code "MAX(info.fordblks, 131072)" to get the right value
> to trigger mmap.
>
>
> My 2 cents:
>
> From what I understand, once we request memory larger than the upper
> limit DEFAULT_MMAP_THRESHOLD_MAX, Glibc will always make use
> of mmap() because it will be out of any value it can adjust in dynamical.
> So that we don't be bothered with this issue anymore.
But in subsequent malloc, the previous mmap area will add into arena and
we still will increase the threashold. I use 8M size to test.
>
> Or:
>
> Invoking mallopt(M_MMAP_THRESHOLD, ...) function in front of the
> SAFE_MALLOC helps to fix the threshold. In such a case, the dynamic
> adjustment of the mmap threshold will be disabled.
Yes, it works well. Thanks for your review.
>
> --
> Regards,
> Li Wang