Skip to content

Commit

Permalink
selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb…
Browse files Browse the repository at this point in the history
…_reparenting_test.sh that may cause error

According to the awk manual, the -e option does not need to be specified
in front of 'program' (unless you need to mix program-file).

The redundant -e option can cause error when users use awk tools other
than gawk (for example, mawk does not support the -e option).

Error Example:
awk: not an option: -e

Link: https://lkml.kernel.org/r/VI1P193MB075228810591AF2FDD7D42C599C3A@VI1P193MB0752.EURP193.PROD.OUTLOOK.COM
Signed-off-by: Juntong Deng <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
juntongdeng authored and akpm00 committed Sep 30, 2023
1 parent 2452626 commit bbe246f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/mm/charge_reserved_hugetlb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ if [[ "$1" == "-cgroup-v2" ]]; then
fi

if [[ $cgroup2 ]]; then
cgroup_path=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
cgroup_path=$(mount -t cgroup2 | head -1 | awk '{print $3}')
if [[ -z "$cgroup_path" ]]; then
cgroup_path=/dev/cgroup/memory
mount -t cgroup2 none $cgroup_path
do_umount=1
fi
echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
else
cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}')
cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
if [[ -z "$cgroup_path" ]]; then
cgroup_path=/dev/cgroup/memory
mount -t cgroup memory,hugetlb $cgroup_path
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/mm/hugetlb_reparenting_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ fi


if [[ $cgroup2 ]]; then
CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk '{print $3}')
if [[ -z "$CGROUP_ROOT" ]]; then
CGROUP_ROOT=/dev/cgroup/memory
mount -t cgroup2 none $CGROUP_ROOT
do_umount=1
fi
echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control
else
CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}')
CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
if [[ -z "$CGROUP_ROOT" ]]; then
CGROUP_ROOT=/dev/cgroup/memory
mount -t cgroup memory,hugetlb $CGROUP_ROOT
Expand Down

0 comments on commit bbe246f

Please sign in to comment.