Commit bbe246f8 authored by Juntong Deng's avatar Juntong Deng Committed by Andrew Morton

selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and...

selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb_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.COMSigned-off-by: default avatarJuntong Deng <juntong.deng@outlook.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 24526268
...@@ -25,7 +25,7 @@ if [[ "$1" == "-cgroup-v2" ]]; then ...@@ -25,7 +25,7 @@ if [[ "$1" == "-cgroup-v2" ]]; then
fi fi
if [[ $cgroup2 ]]; then 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 if [[ -z "$cgroup_path" ]]; then
cgroup_path=/dev/cgroup/memory cgroup_path=/dev/cgroup/memory
mount -t cgroup2 none $cgroup_path mount -t cgroup2 none $cgroup_path
...@@ -33,7 +33,7 @@ if [[ $cgroup2 ]]; then ...@@ -33,7 +33,7 @@ if [[ $cgroup2 ]]; then
fi fi
echo "+hugetlb" >$cgroup_path/cgroup.subtree_control echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
else 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 if [[ -z "$cgroup_path" ]]; then
cgroup_path=/dev/cgroup/memory cgroup_path=/dev/cgroup/memory
mount -t cgroup memory,hugetlb $cgroup_path mount -t cgroup memory,hugetlb $cgroup_path
......
...@@ -20,7 +20,7 @@ fi ...@@ -20,7 +20,7 @@ fi
if [[ $cgroup2 ]]; then 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 if [[ -z "$CGROUP_ROOT" ]]; then
CGROUP_ROOT=/dev/cgroup/memory CGROUP_ROOT=/dev/cgroup/memory
mount -t cgroup2 none $CGROUP_ROOT mount -t cgroup2 none $CGROUP_ROOT
...@@ -28,7 +28,7 @@ if [[ $cgroup2 ]]; then ...@@ -28,7 +28,7 @@ if [[ $cgroup2 ]]; then
fi fi
echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control
else 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 if [[ -z "$CGROUP_ROOT" ]]; then
CGROUP_ROOT=/dev/cgroup/memory CGROUP_ROOT=/dev/cgroup/memory
mount -t cgroup memory,hugetlb $CGROUP_ROOT mount -t cgroup memory,hugetlb $CGROUP_ROOT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment