File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -1285,6 +1285,22 @@ static __always_inline void osnoise_stop_tracing(void)
1285
1285
rcu_read_unlock ();
1286
1286
}
1287
1287
1288
+ /*
1289
+ * osnoise_has_tracing_on - Check if there is at least one instance on
1290
+ */
1291
+ static __always_inline int osnoise_has_tracing_on (void )
1292
+ {
1293
+ struct osnoise_instance * inst ;
1294
+ int trace_is_on = 0 ;
1295
+
1296
+ rcu_read_lock ();
1297
+ list_for_each_entry_rcu (inst , & osnoise_instances , list )
1298
+ trace_is_on += tracer_tracing_is_on (inst -> tr );
1299
+ rcu_read_unlock ();
1300
+
1301
+ return trace_is_on ;
1302
+ }
1303
+
1288
1304
/*
1289
1305
* notify_new_max_latency - Notify a new max latency via fsnotify interface.
1290
1306
*/
@@ -1517,13 +1533,16 @@ static struct cpumask save_cpumask;
1517
1533
/*
1518
1534
* osnoise_sleep - sleep until the next period
1519
1535
*/
1520
- static void osnoise_sleep (void )
1536
+ static void osnoise_sleep (bool skip_period )
1521
1537
{
1522
1538
u64 interval ;
1523
1539
ktime_t wake_time ;
1524
1540
1525
1541
mutex_lock (& interface_lock );
1526
- interval = osnoise_data .sample_period - osnoise_data .sample_runtime ;
1542
+ if (skip_period )
1543
+ interval = osnoise_data .sample_period ;
1544
+ else
1545
+ interval = osnoise_data .sample_period - osnoise_data .sample_runtime ;
1527
1546
mutex_unlock (& interface_lock );
1528
1547
1529
1548
/*
@@ -1604,8 +1623,14 @@ static int osnoise_main(void *data)
1604
1623
if (osnoise_migration_pending ())
1605
1624
break ;
1606
1625
1626
+ /* skip a period if tracing is off on all instances */
1627
+ if (!osnoise_has_tracing_on ()) {
1628
+ osnoise_sleep (true);
1629
+ continue ;
1630
+ }
1631
+
1607
1632
run_osnoise ();
1608
- osnoise_sleep ();
1633
+ osnoise_sleep (false );
1609
1634
}
1610
1635
1611
1636
migrate_enable ();
You can’t perform that action at this time.
0 commit comments