File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3285,7 +3285,13 @@ static const u64 min_bandwidth_expiration = 2 * NSEC_PER_MSEC;
3285
3285
/* how long we wait to gather additional slack before distributing */
3286
3286
static const u64 cfs_bandwidth_slack_period = 5 * NSEC_PER_MSEC ;
3287
3287
3288
- /* are we near the end of the current quota period? */
3288
+ /*
3289
+ * Are we near the end of the current quota period?
3290
+ *
3291
+ * Requires cfs_b->lock for hrtimer_expires_remaining to be safe against the
3292
+ * hrtimer base being cleared by __hrtimer_start_range_ns. In the case of
3293
+ * migrate_hrtimers, base is never cleared, so we are fine.
3294
+ */
3289
3295
static int runtime_refresh_within (struct cfs_bandwidth * cfs_b , u64 min_expire )
3290
3296
{
3291
3297
struct hrtimer * refresh_timer = & cfs_b -> period_timer ;
@@ -3361,10 +3367,12 @@ static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b)
3361
3367
u64 expires ;
3362
3368
3363
3369
/* confirm we're still not at a refresh boundary */
3364
- if (runtime_refresh_within (cfs_b , min_bandwidth_expiration ))
3370
+ raw_spin_lock (& cfs_b -> lock );
3371
+ if (runtime_refresh_within (cfs_b , min_bandwidth_expiration )) {
3372
+ raw_spin_unlock (& cfs_b -> lock );
3365
3373
return ;
3374
+ }
3366
3375
3367
- raw_spin_lock (& cfs_b -> lock );
3368
3376
if (cfs_b -> quota != RUNTIME_INF && cfs_b -> runtime > slice ) {
3369
3377
runtime = cfs_b -> runtime ;
3370
3378
cfs_b -> runtime = 0 ;
You can’t perform that action at this time.
0 commit comments