4
我想知道哪些CPU當前進程在Linux系統中, 上運行,並且我有兩個選擇 -struct task_struct中字段'on_cpu'和struct thread_info中字段'cpu'的含義是什麼?
- 拿到野外
on_cpu
在結構task_struct
或 - 獲得結構
thread_info
領域cpu
。
我寫了一個內核模塊編程探測這兩個領域,並得到下面的結果 :
[ 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
,我不知道正確的意思是這兩個領域。