diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-08-29 16:03:37 -0700 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-09-02 13:54:38 +0800 |
commit | bfe2fd60049e91334ce559309c24e1543a2031f7 (patch) | |
tree | 24eea4ee5c4eee00c4699bb7fb0f405eba4b2826 /common | |
parent | c5cef5ba74ede0b42a1f90e29b4175ed5cbb6a27 (diff) |
common: split _get_hugepagesize into detection and actual query
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@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/rc | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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() |