Skip to content

Fixes for compaction_test

Dev Jain linux-kselftest linux-mm lkml stable 2 versions – Applied

Status from this message: [merged mm-hotfixes-stable] selftests-mm-compaction_test-fix-bogus-test-success-and-reduce-probability-of-oom-killer-invocation.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesApplied 3/3
  2. v12 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Handle an unsigned long number of hugepages
- Combine the first patch (previously standalone) with this series

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3selftests/mm: compaction_test: Fix bogus test success on Aarch64tools/testing/selftests/mm/compaction_test.c+13 -70 repliesApplied
2/3selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepagestools/testing/selftests/mm/compaction_test.c+2 -00 repliesApplied
3/3selftests/mm: compaction_test: Fix bogus test success and reduce probability of OOM-killer invocationtools/testing/selftests/mm/compaction_test.c+49 -220 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] Fixes for compaction_test

The compaction_test memory selftest introduces fragmentation in memory and then tries to allocate as many hugepages as possible. This series addresses some problems.

On Aarch64, if nr_hugepages == 0, then the test trivially succeeds since compaction_index becomes 0, which is less than 3, due to no division by zero exception being raised. We fix that by checking for division by zero.

Secondly, correctly set the number of hugepages to zero before trying to set a large number of them.

Now, consider a situation in which, at the start of the test, a non-zero number of hugepages have been already set (while running the entire selftests/mm suite, or manually by the admin). The test operates on 80% of memory to avoid OOM-killer invocation, and because some memory is already blocked by hugepages, it would increase the chance of OOM-killing. Also, since mem_free used in check_compaction() is the value before we set nr_hugepages to zero, the chance that the compaction_index will be small is very high if the preset nr_hugepages was high, leading to a bogus test success.

This series applies on top of the stable 6.9 kernel.

Changes in v2:
- Handle an unsigned long number of hugepages
- Combine the first patch (previously standalone) with this series

Link to v1:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

Dev Jain (3):
selftests/mm: compaction_test: Fix bogus test success on Aarch64 selftests/mm: compaction_test: Fix incorrect write of zero to
nr_hugepages
selftests/mm: compaction_test: Fix bogus test success and reduce
probability of OOM-killer invocation

 tools/testing/selftests/mm/compaction_test.c | 85 ++++++++++++++------
 1 file changed, 60 insertions(+), 25 deletions(-)
Signature · 1 line
2.34.1