1 From bbe246f875d064ecfb872fe4f66152e743dfd22d Mon Sep 17 00:00:00 2001
2 From: Juntong Deng <juntong.deng@outlook.com>
3 Date: Wed, 27 Sep 2023 02:19:44 +0800
4 Subject: selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh that may cause error
6 From: Juntong Deng <juntong.deng@outlook.com>
8 commit bbe246f875d064ecfb872fe4f66152e743dfd22d upstream.
10 According to the awk manual, the -e option does not need to be specified
11 in front of 'program' (unless you need to mix program-file).
13 The redundant -e option can cause error when users use awk tools other
14 than gawk (for example, mawk does not support the -e option).
17 awk: not an option: -e
19 Link: https://lkml.kernel.org/r/VI1P193MB075228810591AF2FDD7D42C599C3A@VI1P193MB0752.EURP193.PROD.OUTLOOK.COM
20 Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
21 Cc: Shuah Khan <shuah@kernel.org>
22 Cc: <stable@vger.kernel.org>
23 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 4 ++--
27 tools/testing/selftests/mm/hugetlb_reparenting_test.sh | 4 ++--
28 2 files changed, 4 insertions(+), 4 deletions(-)
30 --- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
31 +++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
32 @@ -25,7 +25,7 @@ if [[ "$1" == "-cgroup-v2" ]]; then
35 if [[ $cgroup2 ]]; then
36 - cgroup_path=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
37 + cgroup_path=$(mount -t cgroup2 | head -1 | awk '{print $3}')
38 if [[ -z "$cgroup_path" ]]; then
39 cgroup_path=/dev/cgroup/memory
40 mount -t cgroup2 none $cgroup_path
41 @@ -33,7 +33,7 @@ if [[ $cgroup2 ]]; then
43 echo "+hugetlb" >$cgroup_path/cgroup.subtree_control
45 - cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}')
46 + cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
47 if [[ -z "$cgroup_path" ]]; then
48 cgroup_path=/dev/cgroup/memory
49 mount -t cgroup memory,hugetlb $cgroup_path
50 --- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
51 +++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
55 if [[ $cgroup2 ]]; then
56 - CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
57 + CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk '{print $3}')
58 if [[ -z "$CGROUP_ROOT" ]]; then
59 CGROUP_ROOT=/dev/cgroup/memory
60 mount -t cgroup2 none $CGROUP_ROOT
61 @@ -28,7 +28,7 @@ if [[ $cgroup2 ]]; then
63 echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control
65 - CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}')
66 + CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}')
67 if [[ -z "$CGROUP_ROOT" ]]; then
68 CGROUP_ROOT=/dev/cgroup/memory
69 mount -t cgroup memory,hugetlb $CGROUP_ROOT