For kernel commit c4c27fbdda4e8ba87806c415b6d15266b07bce4b,
disallow attaching kthreadd or PF_THREAD_BOUND threads to cgroups.

The following testcases in cgroup_fj_testcases.sh will encounter
"echo: write error: Invalid argument" error while attach tasks to the cgroup.
function        1 1 1 1 1 3 1 1 1
function        1 1 1 1 1 3 2 1 1
function        1 1 1 1 1 3 4 1 1

Error messages as follows:
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 295: echo: write error: 
Invalid argument
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10571 Killed             
     $TESTROOT/cgroup_fj_proc
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10573 Killed             
     $TESTROOT/cgroup_fj_proc
cgroup_test_fj    1  TFAIL  :  ltpapicmd.c:190: case98(function 1 1 1 1 1 3 1 1 
1)    FAIL
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 295: echo: write error: 
Invalid argument
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10624 Killed             
     $TESTROOT/cgroup_fj_proc
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10626 Killed             
     $TESTROOT/cgroup_fj_proc
cgroup_test_fj    1  TFAIL  :  ltpapicmd.c:190: case99(function 1 1 1 1 1 3 2 1 
1)    FAIL
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 295: echo: write error: 
Invalid argument
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10677 Killed             
     $TESTROOT/cgroup_fj_proc
/opt/ltp/testcases/bin/cgroup_fj_utility.sh: line 497: 10679 Killed             
     $TESTROOT/cgroup_fj_proc
cgroup_test_fj    1  TFAIL  :  ltpapicmd.c:190: case100(function        1 1 1 1 
1 3 4 1 1)    FAIL

So, we kindly avoid to attach these threads in cgroup tests.

Signed-off-by: Li Jinyue <lijin...@huawei.com>
---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh 
b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh
index 30476bd..7614308 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh
@@ -186,6 +186,17 @@ case $attach_operation in
        do
                cur_pid=`sed -n "$i""p" $TMPFILE`
                if [ -e /proc/$cur_pid/ ];then
+                       #For kernel 3.4.0 and higher,kernel disallow attaching 
kthreadd or
+                       #PF_THREAD_BOUND threads to cgroups.
+                       #kernel commit: c4c27fbdda4e8ba87806c415b6d15266b07bce4b
+                       tst_kvercmp 3 4 0
+                       if [ $? -ne 0 ]; then
+                               thread_flag=$(awk '{print $9}' 
/proc/$cur_pid/stat)
+                               thread_name=$(awk '{print $2}' 
/proc/$cur_pid/status | head -1)
+                               if [ "$thread_name" = "kthreadd" -o 
$((${thread_flag}&0x04000000)) -ne 0 ];then
+                                       continue
+                               fi
+                       fi
                        do_echo 1 1 "$cur_pid" /dev/cgroup/subgroup_1/tasks
                fi
        done
-- 1.8.2.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to