Call tick_nohz_task_switch() slightly earlier after the context switch to benefit from disabled IRQs. This way the function doesn't need to disable them once more.
Showing the changes to kernel (2 of 2 files). Show all
Unified · Split
| @@ -4212,6 +4212,7 @@ static struct rq *finish_task_switch(struct task_struct *prev) · 4211 unmodified lines | ||
| 4212 | 4212 | vtime_task_switch(prev); |
| 4213 | 4213 | perf_event_task_sched_in(prev, current); |
| 4214 | 4214 | finish_task(prev); |
| 4215 | + tick_nohz_task_switch(); | |
| 4215 | 4216 | finish_lock_switch(rq); |
| 4216 | 4217 | finish_arch_post_lock_switch(); |
| 4217 | 4218 | kcov_finish_switch(current); |
| @@ -4257,7 +4258,6 @@ static struct rq *finish_task_switch(struct task_struct *prev) · 39 unmodified lines | ||
| 4257 | 4258 | put_task_struct_rcu_user(prev); |
| 4258 | 4259 | } |
| 4259 | 4260 | |
| 4260 | − tick_nohz_task_switch(); | |
| 4261 | 4261 | return rq; |
| 4262 | 4262 | } |
| 4263 | 4263 | |
| @@ -487,13 +487,10 @@ void tick_nohz_dep_clear_signal(struct signal_struct *sig, enum tick_dep_bits bi · 486 unmodified lines | ||
| 487 | 487 | */ |
| 488 | 488 | void __tick_nohz_task_switch(void) |
| 489 | 489 | { |
| 490 | − unsigned long flags; | |
| 491 | 490 | struct tick_sched *ts; |
| 492 | 491 | |
| 493 | − local_irq_save(flags); | |
| 494 | − | |
| 495 | 492 | if (!tick_nohz_full_cpu(smp_processor_id())) |
| 496 | − goto out; | |
| 493 | + return; | |
| 497 | 494 | |
| 498 | 495 | ts = this_cpu_ptr(&tick_cpu_sched); |
| 499 | 496 | |
| @@ -502,8 +499,6 @@ void __tick_nohz_task_switch(void) · 2 unmodified lines | ||
| 502 | 499 | atomic_read(¤t->signal->tick_dep_mask)) |
| 503 | 500 | tick_nohz_full_kick(); |
| 504 | 501 | } |
| 505 | −out: | |
| 506 | − local_irq_restore(flags); | |
| 507 | 502 | } |
| 508 | 503 | |
| 509 | 504 | /* Get the boot-time nohz CPU list from the kernel parameters. */ |