File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -396,13 +396,19 @@ static int kthread_fn(void *data)
396
396
static void stop_single_kthread (void )
397
397
{
398
398
struct hwlat_kthread_data * kdata = get_cpu_data ();
399
- struct task_struct * kthread = kdata -> kthread ;
399
+ struct task_struct * kthread ;
400
+
401
+ get_online_cpus ();
402
+ kthread = kdata -> kthread ;
400
403
401
404
if (!kthread )
402
- return ;
405
+ goto out_put_cpus ;
403
406
404
407
kthread_stop (kthread );
405
408
kdata -> kthread = NULL ;
409
+
410
+ out_put_cpus :
411
+ put_online_cpus ();
406
412
}
407
413
408
414
@@ -419,20 +425,19 @@ static int start_single_kthread(struct trace_array *tr)
419
425
struct task_struct * kthread ;
420
426
int next_cpu ;
421
427
428
+ get_online_cpus ();
422
429
if (kdata -> kthread )
423
- return 0 ;
430
+ goto out_put_cpus ;
424
431
425
432
kthread = kthread_create (kthread_fn , NULL , "hwlatd" );
426
433
if (IS_ERR (kthread )) {
427
434
pr_err (BANNER "could not start sampling thread\n" );
435
+ put_online_cpus ();
428
436
return - ENOMEM ;
429
437
}
430
438
431
-
432
439
/* Just pick the first CPU on first iteration */
433
- get_online_cpus ();
434
440
cpumask_and (current_mask , cpu_online_mask , tr -> tracing_cpumask );
435
- put_online_cpus ();
436
441
437
442
if (hwlat_data .thread_mode == MODE_ROUND_ROBIN ) {
438
443
next_cpu = cpumask_first (current_mask );
@@ -446,6 +451,8 @@ static int start_single_kthread(struct trace_array *tr)
446
451
kdata -> kthread = kthread ;
447
452
wake_up_process (kthread );
448
453
454
+ out_put_cpus :
455
+ put_online_cpus ();
449
456
return 0 ;
450
457
}
451
458
You can’t perform that action at this time.
0 commit comments