栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Go语言

Linux内核SMP机间中断(一)

Go语言 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux内核SMP机间中断(一)

        利用底层IPI处理器之间的中断机制,Linux内核可以实现在指定的CPU上执行某个函数的功能。本地CPU,即smp_processor_id()返回的CPU,通过调用smp_call_function函数来指定其他一个或若干个CPU来执行某个回调函数。

        smp_call_function函数的基本参数包括:

  •         int cpu                                被指定的一个cpu
  •         struct cpumask *mask        被指定的一个CPU集合,这里可能有两种模式
  1. 在指定的CPU集合内的任意一个CPU,在指定CPU集合中选择一个CPU的优先级为:本地cpu;当前NUMA结点上的cpu;其他在线cpu。
  2. 在指定CPU集合上的每一个CPU
  •         smp_call_func_t func          回调函数指针
  •         int wait                                表示smp_call_function是否等待回调函数完成

指定CPU

int smp_call_function_single (int cpu, smp_call_func_t func, void *info, int wait)

指定CPU集合中的一个CPU

int smp_call_function_any(const struct cpumask *mask, smp_call_func_t func, void *info, int wait)

指定CPU集合中的每一个CPU

void smp_call_function_many(const struct cpumask *mask, smp_call_func_t func, void *info, bool wait)

系统内其他所有CPU

void smp_call_function(smp_call_func_t func, void *info, int wait)

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/990768.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号