why vfree() must not be called in interrupt context?

本文详细解释了在x86 SMP环境下,两个处理器同时尝试进行TLB刷新时如何导致死锁的情况,以及通过使用IPIs解决这一问题的方法。
Q: Why vfree must not be called in interrupt context?

A: the tlb flushing can deadlock with IRQs disabled as it relies on IPIs

suppose two cpus are in interrupt context (with interrupts disabled),
both then want to vfree which would result in a TLB flush, the TLB flush
will IPI the other cpu to clear its TLB, but the other CPU has interrupts

disabled so both keep waiting for the other to process the TLB flush -> deadlock.


在x86的smp环境下,一个processor可以通过他自己的local apic向其他的cpu 发送interrupt (inter-processor interrupt)。

如果需要在每个cpu上flush tlb的话,就需要用到ipi了。

void flush_tlb_all(void)
{
        on_each_cpu(do_flush_tlb_all, NULL, 1);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值