Re: [PATCH 0/9] Add tests for memblock allocation functions

From: Mike Rapoport
Date: Wed Mar 09 2022 - 10:10:59 EST


On Mon, Mar 07, 2022 at 08:17:39PM +0200, Mike Rapoport wrote:
> Hi Karolina,
>
> On Mon, Feb 28, 2022 at 03:46:42PM +0100, Karolina Drobnik wrote:
> > Patches are on top of memblock/for-next.
> >
> > This series adds test coverage for memblock allocation functions that return
> > virtual addresses:
> > * memblock_alloc
> > * memblock_alloc_try_nid
> > * memblock_alloc_from
> >
> > These tests are a part of memblock simulator, a user space test suite that uses
> > the actual memblock code[1]. All the tests are run as one, monolithic test, that
> > exercises both basic operations and allocation functions of memblock.
> >
> > To simplify implementation of the memory allocation tests, reset_memblock() was
> > split into two functions - reset_memblock_attributes() and
> > reset_memblock_regions(). The former sets default values for region array names,
> > allocation direction flag (bottom_up) and current memory limit. The latter only
> > resets region arrays and corresponding counters.
> >
> > In addition to these, the patch set introduces a data structure that simulates
> > physical memory, test_memory. It is a simple wrapper around a pointer to the
> > memory block allocated via malloc(), which is added to memblock as available
> > memory. This is required because the tested functions interact with the memory
> > before allocating it.
> >
> > Patchset structure:
> > * Patch 1 splits reset_memblock() into two functions -
> > reset_memblock_regions() and reset_memblock_attributes(), and updates
> > basic API tests to use the new definitions
> > * Patch 2 adds test_memory struct and functions to add (or release) dummy
> > physical memory
> > * Patches 3 - 8 add test cases for memblock_alloc, memblock_alloc_try_nid and
> > memblock_alloc_from for both allocation directions (default top down and
> > bottom up)
> > * Patch 9 adds README and TODO files
>
> Except for few minor comments about README and TODO these patches look good
> to me.

I went ahead and applied this series with some formatting fixes.