11/06/2018 22:55, Anatoly Burakov: > This patchset is mostly dealing with changes fbarray, but it is > actually about reducing fragmentation in Linuxapp memalloc. > > We allocate hugepages from lower VA to higher VA. However, our > malloc heap allocates addresses from higher VA to lower VA. This > results in a situation where, whenever new page is allocated, > malloc starts to allocate memory from the top, leaving fragmented > space between new allocation's leftover and previous leftover. > > Over time, this leads to lots of free elements sitting at page > boundaries, small enough to be useful but large enough to have an > impact on memory fragmentation in certain circumstances. > > To fix this, we need to allocate memory from higher VA first. > However, in order to do that, we need the ability to search fbarray > in reverse, which is currently not supported. Adding this support is > what most of this patchset is about. > > First 4 patches fix some issues in existing fbarray implementation > and remove some code duplication, preparing for adding of new > functionality. > > Next 3 patches add new functionality - reverse search of used/free > slots, mirroring already existing functionality in semantics and > capable of returning identical results but in reverse order. > > Patch 8 adds unit tests for fbarray, testing both existing and new > functionality. > > Finally, patch 9 changes memalloc to look up free slots in memseg > list in reverse order. No other changes is necessary, as all other > code can handle segments, wherever they are allocated. > > Anatoly Burakov (9): > fbarray: fix errno values returned from functions > fbarray: reduce duplication in find_contig code > fbarray: reduce duplication in find_next_n code > fbarray: reduce duplication in find_next code > fbarray: add reverse find_free/used > fbarray: add reverse find n used/free > fbarray: add reverse find contig used/free > test: add fbarray autotests > memalloc: allocate memory in reverse
Applied, thanks

