函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:arch\x86\kernel\cpu\resctrl\rdtgroup.c Create Date:2022-07-27 09:11:37
首页 Copyright©Brick

1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
static int set_cache_qos_cfg(int level, bool enable)
{
    void (*update)(void *arg);
    struct rdt_resource *r_l;
    cpumask_var_t cpu_mask;
    struct rdt_domain *d;
    int cpu;
 
    if (level == RDT_RESOURCE_L3)
        update = l3_qos_cfg_update;
    else if (level == RDT_RESOURCE_L2)
        update = l2_qos_cfg_update;
    else
        return -EINVAL;
 
    if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL))
        return -ENOMEM;
 
    r_l = &rdt_resources_all[level];
    list_for_each_entry(d, &r_l->domains, list) {
        /* Pick one CPU from each domain instance to update MSR */
        cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
    }
    cpu = get_cpu();
    /* Update QOS_CFG MSR on this cpu if it's in cpu_mask. */
    if (cpumask_test_cpu(cpu, cpu_mask))
        update(&enable);
    /* Update QOS_CFG MSR on all other cpus in cpu_mask. */
    smp_call_function_many(cpu_mask, update, &enable, 1);
    put_cpu();
 
    free_cpumask_var(cpu_mask);
 
    return 0;
}