Loading include/linux/cpu.h +2 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,8 @@ static inline int remove_cpu(unsigned int cpu) { return -EPERM; } static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } #endif /* !CONFIG_HOTPLUG_CPU */ DEFINE_LOCK_GUARD_0(cpus_read_lock, cpus_read_lock(), cpus_read_unlock()) #ifdef CONFIG_PM_SLEEP_SMP extern int freeze_secondary_cpus(int primary); extern void thaw_secondary_cpus(void); Loading kernel/sched/core.c +19 −19 Original line number Diff line number Diff line Loading @@ -10802,11 +10802,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota, * Prevent race between setting of cfs_rq->runtime_enabled and * unthrottle_offline_cfs_rqs(). */ cpus_read_lock(); mutex_lock(&cfs_constraints_mutex); guard(cpus_read_lock)(); guard(mutex)(&cfs_constraints_mutex); ret = __cfs_schedulable(tg, period, quota); if (ret) goto out_unlock; return ret; runtime_enabled = quota != RUNTIME_INF; runtime_was_enabled = cfs_b->quota != RUNTIME_INF; Loading @@ -10816,39 +10817,38 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota, */ if (runtime_enabled && !runtime_was_enabled) cfs_bandwidth_usage_inc(); raw_spin_lock_irq(&cfs_b->lock); scoped_guard (raw_spinlock_irq, &cfs_b->lock) { cfs_b->period = ns_to_ktime(period); cfs_b->quota = quota; cfs_b->burst = burst; __refill_cfs_bandwidth_runtime(cfs_b); /* Restart the period timer (if active) to handle new period expiry: */ /* * Restart the period timer (if active) to handle new * period expiry: */ if (runtime_enabled) start_cfs_bandwidth(cfs_b); raw_spin_unlock_irq(&cfs_b->lock); } for_each_online_cpu(i) { struct cfs_rq *cfs_rq = tg->cfs_rq[i]; struct rq *rq = cfs_rq->rq; struct rq_flags rf; rq_lock_irq(rq, &rf); guard(rq_lock_irq)(rq); cfs_rq->runtime_enabled = runtime_enabled; cfs_rq->runtime_remaining = 0; if (cfs_rq->throttled) unthrottle_cfs_rq(cfs_rq); rq_unlock_irq(rq, &rf); } if (runtime_was_enabled && !runtime_enabled) cfs_bandwidth_usage_dec(); out_unlock: mutex_unlock(&cfs_constraints_mutex); cpus_read_unlock(); return ret; return 0; } static int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) Loading Loading
include/linux/cpu.h +2 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,8 @@ static inline int remove_cpu(unsigned int cpu) { return -EPERM; } static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } #endif /* !CONFIG_HOTPLUG_CPU */ DEFINE_LOCK_GUARD_0(cpus_read_lock, cpus_read_lock(), cpus_read_unlock()) #ifdef CONFIG_PM_SLEEP_SMP extern int freeze_secondary_cpus(int primary); extern void thaw_secondary_cpus(void); Loading
kernel/sched/core.c +19 −19 Original line number Diff line number Diff line Loading @@ -10802,11 +10802,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota, * Prevent race between setting of cfs_rq->runtime_enabled and * unthrottle_offline_cfs_rqs(). */ cpus_read_lock(); mutex_lock(&cfs_constraints_mutex); guard(cpus_read_lock)(); guard(mutex)(&cfs_constraints_mutex); ret = __cfs_schedulable(tg, period, quota); if (ret) goto out_unlock; return ret; runtime_enabled = quota != RUNTIME_INF; runtime_was_enabled = cfs_b->quota != RUNTIME_INF; Loading @@ -10816,39 +10817,38 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota, */ if (runtime_enabled && !runtime_was_enabled) cfs_bandwidth_usage_inc(); raw_spin_lock_irq(&cfs_b->lock); scoped_guard (raw_spinlock_irq, &cfs_b->lock) { cfs_b->period = ns_to_ktime(period); cfs_b->quota = quota; cfs_b->burst = burst; __refill_cfs_bandwidth_runtime(cfs_b); /* Restart the period timer (if active) to handle new period expiry: */ /* * Restart the period timer (if active) to handle new * period expiry: */ if (runtime_enabled) start_cfs_bandwidth(cfs_b); raw_spin_unlock_irq(&cfs_b->lock); } for_each_online_cpu(i) { struct cfs_rq *cfs_rq = tg->cfs_rq[i]; struct rq *rq = cfs_rq->rq; struct rq_flags rf; rq_lock_irq(rq, &rf); guard(rq_lock_irq)(rq); cfs_rq->runtime_enabled = runtime_enabled; cfs_rq->runtime_remaining = 0; if (cfs_rq->throttled) unthrottle_cfs_rq(cfs_rq); rq_unlock_irq(rq, &rf); } if (runtime_was_enabled && !runtime_enabled) cfs_bandwidth_usage_dec(); out_unlock: mutex_unlock(&cfs_constraints_mutex); cpus_read_unlock(); return ret; return 0; } static int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) Loading