广播模式

/*
 * Periodic broadcast:
 * - invoke the broadcast handlers
 */
static void tick_do_periodic_broadcast(void)
{
	raw_spin_lock(&tick_broadcast_lock);

	cpumask_and(to_cpumask(tmpmask),                           //确定受影响的CPU
		    cpu_online_mask, tick_get_broadcast_mask());
	tick_do_broadcast(to_cpumask(tmpmask));                    //

	raw_spin_unlock(&tick_broadcast_lock);
}

tick_do_broadcast():

/*
 * Broadcast the event to the cpus, which are set in the mask (mangled).
 */
static void tick_do_broadcast(struct cpumask *mask)
{
	int cpu = smp_processor_id();
	struct tick_device *td;

	/*
	 * Check, if the current cpu is in the mask
	 */
	if (cpumask_test_cpu(cpu, mask)) { //当前CPU是否处于广播的掩码中?
		cpumask_clear_cpu(cpu, mask); //从掩码中移除该CPU
		td = &per_cpu(tick_cpu_device, cpu);
		td->evtdev->event_handler(td->evtdev); //对当前CPU调用event_handler
	}

	if (!cpumask_empty(mask)) {  //掩码中是否还有更多的CPU
		/*
		 * It might be necessary to actually check whether the devices
		 * have different broadcast functions. For now, just use the
		 * one of the first device. This works as long as we have this
		 * misfeature only on x86 (lapic)
		 */
		td = &per_cpu(tick_cpu_device, cpumask_first(mask));
/*
*对与局部APIC来说,broadcast方法指向lapic_timer_interrupt。对所有与不同时钟设备相关联的CPU,该方法负责
*发送处理器中断LOCAL_TIMER_VECTOR,该中断的中断向量由内核设置为调用apic_timer_interrupt。其结果就是,时钟
*事件设备无法区分IPI和真正的中断,因而其效果与设备仍然处于工作状态是相同的。
*/
		td->evtdev->broadcast(mask);
	}
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值