On 01/29/2015 03:09 PM, Lijinyue wrote:
> Since kernel commit c4c27fbdda4e8ba87806c415b6d15266b07bce4b and
> 14a40ffccd6163bbcd1d6f32b28a88ffe6149fc6, disallow attaching kthreadd
> or threads with flag 0x04000000 to cgroups.
> (Thread flag 0x04000000 is representation of PF_THREAD_BOUND which
> had been replaced with PF_NO_SETAFFINITY on kernel 3.9 and later.)
> 
> The following testcases in cgroup_fj_testcases.sh will encounter
> "echo: write error: Invalid argument" error while attaching 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>

Acked-by: Wanlong Gao <gaowanl...@cn.fujitsu.com>


> ---
>  .../kernel/controllers/cgroup_fj/cgroup_fj_function.sh      | 13 
> +++++++++++++
>  1 file changed, 13 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..9bfaeb7 100755
> --- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh
> +++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh
> @@ -186,6 +186,19 @@ 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
> +                     #threads with flag 0x04000000 to cgroups.
> +                     #kernel commit:
> +                     #c4c27fbdda4e8ba87806c415b6d15266b07bce4b
> +                     #14a40ffccd6163bbcd1d6f32b28a88ffe6149fc6
> +                     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
> .
> 


------------------------------------------------------------------------------
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