mbox series

[v3,0/5] memblock tests: add tests for memblock_alloc_exact_nid_raw

Message ID cover.1666203642.git.remckee0@gmail.com (mailing list archive)
Headers show
Series memblock tests: add tests for memblock_alloc_exact_nid_raw | expand

Message

Rebecca Mckeever Oct. 19, 2022, 6:34 p.m. UTC
These patches add tests for memblock_alloc_exact_nid_raw(). There are two
sets of tests: range tests and NUMA tests. The range tests use a normal
(i.e., UMA) simulated physical memory and set the nid to NUMA_NO_NODE. The
NUMA tests use a simulated physical memory that is set up with multiple
NUMA nodes. Additionally, most of the NUMA tests set nid != NUMA_NO_NODE.

For the range tests, the TEST_F_EXACT flag is used to run the same set of
range tests used for memblock_alloc_try_nid_raw(). The NUMA tests have the
same setup as the corresponding test for memblock_alloc_try_nid_raw(), but
several of the memblock_alloc_exact_nid_raw() tests fail to allocate
memory in setups where the memblock_alloc_try_nid_raw() test would
allocate memory. Also, some memblock_alloc_exact_nid_raw() tests drop the
lower limit of the requested range in order to allocate within the
requested node, but the same setup in a memblock_alloc_try_nid_raw() test
allocates within the requested range.

---
Changelog

v1 -> v2
PATCH 0:
- Add missing memblock_alloc_exact_nid_raw to subject line

v2 -> v3
Based on feedback from David Hildenbrand:
PATCH 1:
- alloc_nid_api.c, alloc_nid_api.h, common.h:
    + Add TEST_F_EXACT flag so that tests in alloc_nid_api.c can be run
      with that flag to test memblock_alloc_exact_nid_raw()
- alloc_exact_nid_api.c:
    + Update to run range tests in alloc_nid_api.c with TEST_F_EXACT flag
      instead of using a separate set of tests
- alloc_nid_api.c:
    + Rename tests and other functions by removing "_try" so that the
      function names are general enough to refer to any of the
      memblock_alloc_*nid*() functions of the memblock API
---

Rebecca Mckeever (5):
  memblock tests: introduce range tests for memblock_alloc_exact_nid_raw
  memblock tests: add top-down NUMA tests for
    memblock_alloc_exact_nid_raw
  memblock tests: add bottom-up NUMA tests for
    memblock_alloc_exact_nid_raw
  memblock tests: add generic NUMA tests for
    memblock_alloc_exact_nid_raw
  memblock tests: remove completed TODO item

 tools/testing/memblock/Makefile               |    2 +-
 tools/testing/memblock/TODO                   |    7 +-
 tools/testing/memblock/main.c                 |    2 +
 .../memblock/tests/alloc_exact_nid_api.c      | 1113 +++++++++++++++++
 .../memblock/tests/alloc_exact_nid_api.h      |   25 +
 tools/testing/memblock/tests/alloc_nid_api.c  |  542 ++++----
 tools/testing/memblock/tests/alloc_nid_api.h  |    1 +
 tools/testing/memblock/tests/common.h         |    2 +
 8 files changed, 1425 insertions(+), 269 deletions(-)
 create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.c
 create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.h

Comments

Rebecca Mckeever Oct. 31, 2022, 5 a.m. UTC | #1
Hi Mike,

I noticed that the memblock tree has been updated since I sent this
patch set. Do you want me to send an updated patch set applied on top of
the current tree?

On Wed, Oct 19, 2022 at 01:34:07PM -0500, Rebecca Mckeever wrote:
> These patches add tests for memblock_alloc_exact_nid_raw(). There are two
> sets of tests: range tests and NUMA tests. The range tests use a normal
> (i.e., UMA) simulated physical memory and set the nid to NUMA_NO_NODE. The
> NUMA tests use a simulated physical memory that is set up with multiple
> NUMA nodes. Additionally, most of the NUMA tests set nid != NUMA_NO_NODE.
> 
> For the range tests, the TEST_F_EXACT flag is used to run the same set of
> range tests used for memblock_alloc_try_nid_raw(). The NUMA tests have the
> same setup as the corresponding test for memblock_alloc_try_nid_raw(), but
> several of the memblock_alloc_exact_nid_raw() tests fail to allocate
> memory in setups where the memblock_alloc_try_nid_raw() test would
> allocate memory. Also, some memblock_alloc_exact_nid_raw() tests drop the
> lower limit of the requested range in order to allocate within the
> requested node, but the same setup in a memblock_alloc_try_nid_raw() test
> allocates within the requested range.
> 
> ---
> Changelog
> 
> v1 -> v2
> PATCH 0:
> - Add missing memblock_alloc_exact_nid_raw to subject line
> 
> v2 -> v3
> Based on feedback from David Hildenbrand:
> PATCH 1:
> - alloc_nid_api.c, alloc_nid_api.h, common.h:
>     + Add TEST_F_EXACT flag so that tests in alloc_nid_api.c can be run
>       with that flag to test memblock_alloc_exact_nid_raw()
> - alloc_exact_nid_api.c:
>     + Update to run range tests in alloc_nid_api.c with TEST_F_EXACT flag
>       instead of using a separate set of tests
> - alloc_nid_api.c:
>     + Rename tests and other functions by removing "_try" so that the
>       function names are general enough to refer to any of the
>       memblock_alloc_*nid*() functions of the memblock API
> ---
> 
> Rebecca Mckeever (5):
>   memblock tests: introduce range tests for memblock_alloc_exact_nid_raw
>   memblock tests: add top-down NUMA tests for
>     memblock_alloc_exact_nid_raw
>   memblock tests: add bottom-up NUMA tests for
>     memblock_alloc_exact_nid_raw
>   memblock tests: add generic NUMA tests for
>     memblock_alloc_exact_nid_raw
>   memblock tests: remove completed TODO item
> 
>  tools/testing/memblock/Makefile               |    2 +-
>  tools/testing/memblock/TODO                   |    7 +-
>  tools/testing/memblock/main.c                 |    2 +
>  .../memblock/tests/alloc_exact_nid_api.c      | 1113 +++++++++++++++++
>  .../memblock/tests/alloc_exact_nid_api.h      |   25 +
>  tools/testing/memblock/tests/alloc_nid_api.c  |  542 ++++----
>  tools/testing/memblock/tests/alloc_nid_api.h  |    1 +
>  tools/testing/memblock/tests/common.h         |    2 +
>  8 files changed, 1425 insertions(+), 269 deletions(-)
>  create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.c
>  create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.h
> 
> -- 
> 2.25.1
> 
Thanks,
Rebecca
Mike Rapoport Oct. 31, 2022, 8:43 a.m. UTC | #2
Hi Rebecca,

On Mon, Oct 31, 2022 at 12:00:06AM -0500, Rebecca Mckeever wrote:
> Hi Mike,
> 
> I noticed that the memblock tree has been updated since I sent this
> patch set. Do you want me to send an updated patch set applied on top of
> the current tree?

No need, the only actual conflict is in TODO, I'll fix it while applying.
 
> On Wed, Oct 19, 2022 at 01:34:07PM -0500, Rebecca Mckeever wrote:
> > These patches add tests for memblock_alloc_exact_nid_raw(). There are two
> > sets of tests: range tests and NUMA tests. The range tests use a normal
> > (i.e., UMA) simulated physical memory and set the nid to NUMA_NO_NODE. The
> > NUMA tests use a simulated physical memory that is set up with multiple
> > NUMA nodes. Additionally, most of the NUMA tests set nid != NUMA_NO_NODE.
> > 
> > For the range tests, the TEST_F_EXACT flag is used to run the same set of
> > range tests used for memblock_alloc_try_nid_raw(). The NUMA tests have the
> > same setup as the corresponding test for memblock_alloc_try_nid_raw(), but
> > several of the memblock_alloc_exact_nid_raw() tests fail to allocate
> > memory in setups where the memblock_alloc_try_nid_raw() test would
> > allocate memory. Also, some memblock_alloc_exact_nid_raw() tests drop the
> > lower limit of the requested range in order to allocate within the
> > requested node, but the same setup in a memblock_alloc_try_nid_raw() test
> > allocates within the requested range.
> > 
> > ---
> > Changelog
> > 
> > v1 -> v2
> > PATCH 0:
> > - Add missing memblock_alloc_exact_nid_raw to subject line
> > 
> > v2 -> v3
> > Based on feedback from David Hildenbrand:
> > PATCH 1:
> > - alloc_nid_api.c, alloc_nid_api.h, common.h:
> >     + Add TEST_F_EXACT flag so that tests in alloc_nid_api.c can be run
> >       with that flag to test memblock_alloc_exact_nid_raw()
> > - alloc_exact_nid_api.c:
> >     + Update to run range tests in alloc_nid_api.c with TEST_F_EXACT flag
> >       instead of using a separate set of tests
> > - alloc_nid_api.c:
> >     + Rename tests and other functions by removing "_try" so that the
> >       function names are general enough to refer to any of the
> >       memblock_alloc_*nid*() functions of the memblock API
> > ---
> > 
> > Rebecca Mckeever (5):
> >   memblock tests: introduce range tests for memblock_alloc_exact_nid_raw
> >   memblock tests: add top-down NUMA tests for
> >     memblock_alloc_exact_nid_raw
> >   memblock tests: add bottom-up NUMA tests for
> >     memblock_alloc_exact_nid_raw
> >   memblock tests: add generic NUMA tests for
> >     memblock_alloc_exact_nid_raw
> >   memblock tests: remove completed TODO item
> > 
> >  tools/testing/memblock/Makefile               |    2 +-
> >  tools/testing/memblock/TODO                   |    7 +-
> >  tools/testing/memblock/main.c                 |    2 +
> >  .../memblock/tests/alloc_exact_nid_api.c      | 1113 +++++++++++++++++
> >  .../memblock/tests/alloc_exact_nid_api.h      |   25 +
> >  tools/testing/memblock/tests/alloc_nid_api.c  |  542 ++++----
> >  tools/testing/memblock/tests/alloc_nid_api.h  |    1 +
> >  tools/testing/memblock/tests/common.h         |    2 +
> >  8 files changed, 1425 insertions(+), 269 deletions(-)
> >  create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.c
> >  create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.h
> > 
> > -- 
> > 2.25.1
> > 
> Thanks,
> Rebecca
David Hildenbrand Oct. 31, 2022, 12:43 p.m. UTC | #3
On 19.10.22 20:34, Rebecca Mckeever wrote:
> These patches add tests for memblock_alloc_exact_nid_raw(). There are two
> sets of tests: range tests and NUMA tests. The range tests use a normal
> (i.e., UMA) simulated physical memory and set the nid to NUMA_NO_NODE. The
> NUMA tests use a simulated physical memory that is set up with multiple
> NUMA nodes. Additionally, most of the NUMA tests set nid != NUMA_NO_NODE.
> 
> For the range tests, the TEST_F_EXACT flag is used to run the same set of
> range tests used for memblock_alloc_try_nid_raw(). The NUMA tests have the
> same setup as the corresponding test for memblock_alloc_try_nid_raw(), but
> several of the memblock_alloc_exact_nid_raw() tests fail to allocate
> memory in setups where the memblock_alloc_try_nid_raw() test would
> allocate memory. Also, some memblock_alloc_exact_nid_raw() tests drop the
> lower limit of the requested range in order to allocate within the
> requested node, but the same setup in a memblock_alloc_try_nid_raw() test
> allocates within the requested range.

Thanks a lot Rebecca for moving forward with these changes even after 
your Outreachy internship ended!