From: Darrick J. Wong <djwong@xxxxxxxxxx> This helper has two parts -- querying the value, and _notrun'ing the test if huge pages aren't turned on. Break these into the usual _require_hugepages and _get_hugepagesize predicates so that we can adapt xfs/559 to large folios being used for writes. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- common/rc | 13 ++++++++----- tests/generic/413 | 1 + tests/generic/605 | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/rc b/common/rc index 68d2ad041e..b5bf3c3bcb 100644 --- a/common/rc +++ b/common/rc @@ -108,14 +108,17 @@ _get_filesize() stat -c %s "$1" } +# Does this kernel support huge pages? +_require_hugepages() +{ + awk '/Hugepagesize/ {print $2}' /proc/meminfo | grep -E -q ^[0-9]+$ || \ + _notrun "Kernel does not report huge page size" +} + # Get hugepagesize in bytes _get_hugepagesize() { - local hugepgsz=$(awk '/Hugepagesize/ {print $2}' /proc/meminfo) - # Call _notrun if $hugepgsz is not a number - echo "$hugepgsz" | grep -E -q ^[0-9]+$ || \ - _notrun "Cannot get the value of Hugepagesize" - echo $((hugepgsz * 1024)) + awk '/Hugepagesize/ {print $2 * 1024}' /proc/meminfo } _mount() diff --git a/tests/generic/413 b/tests/generic/413 index 155f397d1d..bd1b04a624 100755 --- a/tests/generic/413 +++ b/tests/generic/413 @@ -13,6 +13,7 @@ _begin_fstest auto quick dax prealloc . ./common/filter _supported_fs generic +_require_hugepages _require_test _require_scratch_dax_mountopt "dax" _require_test_program "feature" diff --git a/tests/generic/605 b/tests/generic/605 index 77671f39d3..7e814d5ba1 100755 --- a/tests/generic/605 +++ b/tests/generic/605 @@ -13,6 +13,7 @@ _begin_fstest auto attr quick dax prealloc . ./common/filter _supported_fs generic +_require_hugepages _require_scratch_dax_mountopt "dax=always" _require_test_program "feature" _require_test_program "t_mmap_dio"