函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\sched\deadline.c Create Date:2022-07-27 10:41:02
首页 Copyright©Brick

2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
int sched_dl_global_validate(void)
{
    u64 runtime = global_rt_runtime();
    u64 period = global_rt_period();
    u64 new_bw = to_ratio(period, runtime);
    struct dl_bw *dl_b;
    int cpu, ret = 0;
    unsigned long flags;
 
    /*
     * Here we want to check the bandwidth not being set to some
     * value smaller than the currently allocated bandwidth in
     * any of the root_domains.
     *
     * FIXME: Cycling on all the CPUs is overdoing, but simpler than
     * cycling on root_domains... Discussion on different/better
     * solutions is welcome!
     */
    for_each_possible_cpu(cpu) {
        rcu_read_lock_sched();
        dl_b = dl_bw_of(cpu);
 
        raw_spin_lock_irqsave(&dl_b->lock, flags);
        if (new_bw < dl_b->total_bw)
            ret = -EBUSY;
        raw_spin_unlock_irqrestore(&dl_b->lock, flags);
 
        rcu_read_unlock_sched();
 
        if (ret)
            break;
    }
 
    return ret;
}