mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
selftests/mm: fix hugetlb pathname construction in hugetlb_reparenting_test.sh
The hugetlb_reparenting_test.sh script constructs hugetlb cgroup memory
interface file names based on the configured huge page size. The script
formats the size only in MB units, which causes mismatches on systems
using larger huge pages where the kernel exposes normalized units (e.g.
"1GB" instead of "1024MB").
As a result, the test fails to locate the corresponding cgroup files when
1GB huge pages are configured.
Update the script to detect the huge page size and select the appropriate
unit (MB or GB) so that the constructed paths match the kernel's hugetlb
controller naming.
Also print an explicit "Fail" message when a test failure occurs to
improve result visibility.
Link: https://lore.kernel.org/837ce751965c93f74c95d89587debf1e93281364.1779296493.git.sayalip@linux.ibm.com
Fixes: e487a5d513 ("selftest/mm: make hugetlb_reparenting_test tolerant to async reparenting")
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
7f9c0920ff
commit
76f9a212a0
|
|
@ -48,6 +48,13 @@ function get_machine_hugepage_size() {
|
|||
}
|
||||
|
||||
MB=$(get_machine_hugepage_size)
|
||||
if (( MB >= 1024 )); then
|
||||
UNIT="GB"
|
||||
MB_DISPLAY=$((MB / 1024))
|
||||
else
|
||||
UNIT="MB"
|
||||
MB_DISPLAY=$MB
|
||||
fi
|
||||
|
||||
function cleanup() {
|
||||
echo cleanup
|
||||
|
|
@ -88,6 +95,7 @@ function assert_with_retry() {
|
|||
if [[ $elapsed -ge $timeout ]]; then
|
||||
echo "actual = $((${actual%% *} / 1024 / 1024)) MB"
|
||||
echo "expected = $((${expected%% *} / 1024 / 1024)) MB"
|
||||
echo FAIL
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -108,11 +116,13 @@ function assert_state() {
|
|||
fi
|
||||
|
||||
assert_with_retry "$CGROUP_ROOT/a/memory.$usage_file" "$expected_a"
|
||||
assert_with_retry "$CGROUP_ROOT/a/hugetlb.${MB}MB.$usage_file" "$expected_a_hugetlb"
|
||||
assert_with_retry \
|
||||
"$CGROUP_ROOT/a/hugetlb.${MB_DISPLAY}${UNIT}.$usage_file" "$expected_a_hugetlb"
|
||||
|
||||
if [[ -n "$expected_b" && -n "$expected_b_hugetlb" ]]; then
|
||||
assert_with_retry "$CGROUP_ROOT/a/b/memory.$usage_file" "$expected_b"
|
||||
assert_with_retry "$CGROUP_ROOT/a/b/hugetlb.${MB}MB.$usage_file" "$expected_b_hugetlb"
|
||||
assert_with_retry \
|
||||
"$CGROUP_ROOT/a/b/hugetlb.${MB_DISPLAY}${UNIT}.$usage_file" "$expected_b_hugetlb"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user