Re: [問題] set processor affinity
※ 引述《GTFX (我達達的馬蹄~)》之銘言:
: ※ 引述《roylee17 (把我id還我阿......)》之銘言:
: : $ taskset
: : taskset (util-linux-ng 2.17.2)
: : usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
: : set or get the affinity of a process
: : -p, --pid operate on existing given pid
: : -c, --cpu-list display and specify cpus in list format
: : -h, --help display this help
: : -V, --version output version information
: : The default behavior is to run a new command:
: : taskset 03 sshd -b 1024
: : 你的 taskset 套件有不一樣嗎 :)
: 感謝 :) 是我沒看清楚
: 另外問個問題,如果這個process create了一些thread,請問這些thread會migrate嗎?
: 還是也是會bind在這個設定的core上面
設定的 cpumask 一樣會套用在 child process/threads
這個 cpumask 會在 fork/clone 的時候被 child process 繼承
該值對應在 task_struct 中,cpus_allowed 欄位
而在 fork/clone 的過程中,這個欄位會隨著 task_struct 其他欄位
從 parent process 拷貝過來,參考下列的片段:
<LINUX/kernel/fork.c>:
do_fork()
copy_process()
dup_task_struct()
arch_dup_task_struct():
int __attribute__((weak))
arch_dup_task_struct(struct task_struct *dst,
struct task_struct *src)
{
*dst = *src;
return 0;
}
這是 kernel 提供的預設行為,各個 architecture 可以提供
自己的實做,不過沒看到有哪個 architecture 對此行為作調整
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.104.36.142
推
07/17 16:01, , 1F
07/17 16:01, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 5 之 5 篇):