2020-04-21 08:23:11

by Alex Zhuravlev

[permalink] [raw]
Subject: [RFC] improve malloc for large filesystems - limit scanning

Hi, yet another patch.

There is an issue with current mballoc on huge filesystems - when a small allocation is requested, mballoc turns it into a group preallocation (512 blocks by default),
then scans all bitmaps to find this good chunk. The problem is that stages 0 and 1 are optimised for CPU cycles and skip not-interesting groups, but to learn
the group is not interesting it should be initialised. If it’s not then IO is required. If the filesystem is highly fragmented then it may take hours (literally) to find this good
chunk. The previous prefetching patch improves this, but still leads to lots of IO and very expensive allocations in some cases.
This patch changes mballoc in a different way - as stages 0/1 are optimisations, we can skip them for non-initialised groups (e.g. right after mount) and just scan
bitmaps for all available blocks (stage 2).

Please review.

Thanks, Alex


Attachments:
0001-mballoc-limit-scanning-of-uninitialized-groups.patch (1.66 kB)
0001-mballoc-limit-scanning-of-uninitialized-groups.patch