共享LLC来减少ipi中断

linux kernel唤醒进程的步骤:

select task rq,enqueue,active task。

对于enqueue调用链是:try_to_wake_up->ttwu_queue->ttwu_queue_wakelist

复制代码
static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
{
    if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) {
        if (WARN_ON_ONCE(cpu == smp_processor_id()))
            return false;

        sched_clock_cpu(cpu); /* Sync clocks across CPUs */
        __ttwu_queue_wakelist(p, cpu, wake_flags);
        return true;
    }

    return false;
}
复制代码

__ttwu_queue_wakelist会给选择到的cpu发ipi中断,但是要先满足一些条件,包括ttwu_queue_cond。

复制代码
static inline bool ttwu_queue_cond(int cpu, int wake_flags)
{
    /*
     * If the CPU does not share cache, then queue the task on the
     * remote rqs wakelist to avoid accessing remote data.
     */
    if (!cpus_share_cache(smp_processor_id(), cpu))
        return true;
...
  return false; }
复制代码

这个函数表明,如果当前cpu和选择的target cpu是共享llc则返回false。这样__ttwu_queue_wakelist就不会执行,ipi也不会发送。这在vm上的意义是共享llc可以减少ipi中断带来的vm exit。

posted on   半山随笔  阅读(40)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示