Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑一个调度并执行 tasklet 功能的内核 tasklet。
有没有办法知道 tasklet 正在运行哪个内核?我的意思是有一个函数/变量可以知道 tasklet 在哪个核心运行。建筑是手臂。
谢谢!
tasklet 将始终在调度它的同一处理器内核上运行。在内核内部,您可以调用smp_processor_id()以找出您当前正在运行的处理器。
smp_processor_id()
检查 /proc/cpuinfo 以获取处理器编号到物理 id 和核心 id 的映射。超线程将为每个内核创建 2 个逻辑处理器。
见man 7 cpuset。