I want to know which processor of the current process is running on a Linux system, and I have two options -
- get the
on_cpu field in struct task_struct or - get the
cpu field in struct thread_info .
I am writing kernel module programming to probe two fields and get the result below:
[ 3991.419185] the field 'on_cpu' in task_struct is :1 [ 3991.419187] the field 'cpu' in thread_info is :0 [ 3991.419199] the field 'on_cpu' in task_struct is :1 [ 3991.419200] the field 'cpu' in thread_info is :0 [ 3991.419264] the field 'on_cpu' in task_struct is :1 [ 3991.419266] the field 'cpu' in thread_info is :1 [ 3991.419293] the field 'on_cpu' in task_struct is :1 [ 3991.419294] the field 'cpu' in thread_info is :1 [ 3991.419314] the field 'on_cpu' in task_struct is :1 [ 3991.419315] the field 'cpu' in thread_info is :1 [ 3991.419494] the field 'on_cpu' in task_struct is :1 [ 3991.419495] the field 'cpu' in thread_info is :0 [ 3991.419506] the field 'on_cpu' in task_struct is :1 [ 3991.419507] the field 'cpu' in thread_info is :1
and I do not know the correct meaning of these two fields.
source share