test_zero_hugepage.sh: Detect errors write to /proc/sys/vm/nr_hugepages
PATCH 1/1 test_zero_hugepage.sh: Detect errors write to /proc/sys/vm/nr_hugepages
Fix running make test-c as non-root.
---
Hi,
maybe echo "128" would not have to be checked.
Kind regards,
Petr
lib/newlib_tests/test_zero_hugepage.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
lib/newlib_tests/test_zero_hugepage.sh +18 -3
@@ -3,16 +3,31 @@ # Copyright (c) 2021 Yang Xu <[email protected]> # Copyright (c) 2021 Petr Vorel <[email protected]> +tconf() +{ + echo "TCONF: $1" + exit 32 +} + echo "Testing .request_hugepages = TST_NO_HUGEPAGES" orig_value=`cat /proc/sys/vm/nr_hugepages` if grep -q -E '^proc /proc(/sys)? proc ro' /proc/mounts; then - echo "TCONF: /proc or /proc/sys mounted as read-only" - exit 32 + tconf "/proc or /proc/sys mounted as read-only" +fi + +if [ ! -f /proc/sys/vm/nr_hugepages ]; then + tconf "/proc/sys/vm/nr_hugepages does not exist" +fi + +if [ ! -w /proc/sys/vm/nr_hugepages ]; then + tconf "no write permission to /proc/sys/vm/nr_hugepages (run as root)" fi -echo "128" > /proc/sys/vm/nr_hugepages +if ! echo "128" > /proc/sys/vm/nr_hugepages; then + tconf "Failed to write /proc/sys/vm/nr_hugepages" +fi ./test_zero_hugepage
Signature · 5 lines
2.33.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 10 lines · Petr Vorel
Fix running make test-c as non-root.
Fixes 057d6b046 ("lib/tst_hugepage: Fix .request_hugepages = 0 bug")Signed-off-by Petr Vorel <[email protected]>---
Hi,maybe echo "128" would not have to be checked.
Agreed, If the system memory is too fragmental to keep enough hpages, there won't be an error returned.
Quoted 56 lines
Kind regards,
Petrlib/newlib_tests/test_zero_hugepage.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)lib/newlib_tests/test_zero_hugepage.sh +15
-2@@ -3,16 +3,31 @@ # Copyright (c) 2021 Yang Xu <[email protected]> # Copyright (c) 2021 Petr Vorel <[email protected]> +tconf() +{ + echo "TCONF: $1" + exit 32 +} + echo "Testing .request_hugepages = TST_NO_HUGEPAGES" orig_value=`cat /proc/sys/vm/nr_hugepages` if grep -q -E '^proc /proc(/sys)? proc ro' /proc/mounts; then - echo "TCONF: /proc or /proc/sys mounted as read-only" - exit 32 + tconf "/proc or /proc/sys mounted as read-only" +fi + +if [ ! -f /proc/sys/vm/nr_hugepages ]; then + tconf "/proc/sys/vm/nr_hugepages does not exist" +fi + +if [ ! -w /proc/sys/vm/nr_hugepages ]; then + tconf "no write permission to /proc/sys/vm/nr_hugepages (run asroot)"
filib/newlib_tests/test_zero_hugepage.sh +3
-2-echo "128" > /proc/sys/vm/nr_hugepages +if ! echo "128" > /proc/sys/vm/nr_hugepages; then + tconf "Failed to write /proc/sys/vm/nr_hugepages" +fi ./test_zero_hugepage --2.33.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Regards, Li Wang
Signature · 2 lines
-- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li,
Quoted 10 lines · Petr Vorel
Quoted 8 lines
Fix running make test-c as non-root.
Fixes 057d6b046 ("lib/tst_hugepage: Fix .request_hugepages = 0 bug")Signed-off-by Petr Vorel <[email protected]>---
Hi,
Quoted 5 lines
Quoted 1 line
maybe echo "128" would not have to be checked.
Agreed, If the system memory is too fragmental to keep enough hpages, there won't be an error returned.
OK, wait little longer and then merge with keeping echo "128" > /proc/sys/vm/nr_hugepages
...
Quoted 4 lines
lib/newlib_tests/test_zero_hugepage.sh line 30
Quoted 4 lines
lib/newlib_tests/test_zero_hugepage.sh +3
-1-echo "128" > /proc/sys/vm/nr_hugepages +if ! echo "128" > /proc/sys/vm/nr_hugepages; then + tconf "Failed to write /proc/sys/vm/nr_hugepages" +fi
Thanks for your review!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis
Reviewed-byHi!
Quoted 4 lines
Quoted 2 lines
Agreed, If the system memory is too fragmental to keep enough hpages, there won't be an error returned.
OK, wait little longer and then merge with keeping echo "128" >
/proc/sys/vm/nr_hugepages
Also I wonder why do we request 128? I guess that 4 would be more than enough.
Other than that:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril
Quoted 8 lines
Hi!
Quoted 4 lines
Quoted 2 lines
Agreed, If the system memory is too fragmental to keep enough hpages, there won't be an error returned.
OK, wait little longer and then merge with keeping echo "128">
/proc/sys/vm/nr_hugepagesAlso I wonder why do we request 128? I guess that 4 would be more than enough.
I don't think about so much when I wrote this script. Using a small number is also ok for me.
Quoted 5 lines
Other than that:
Reviewed-by Cyril Hrubis<[email protected]>
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi all,
Quoted 11 lines
Hi Cyril
Quoted 8 lines
Hi!
Quoted 4 lines
Quoted 2 lines
Agreed, If the system memory is too fragmental to keep enough hpages, there won't be an error returned.
OK, wait little longer and then merge with keeping echo "128">
/proc/sys/vm/nr_hugepagesAlso I wonder why do we request 128? I guess that 4 would be more than enough.
I don't think about so much when I wrote this script. Using a small number is also ok for me.
Good point! I thought it's needed to have that high value. I'll send a separate patch for this.
Merged this one.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp