Each psi group requires a dedicated kthread_delayed_work and kthread_worker. Since no other work can be performed using psi_group's kthread_worker, the same result can be obtained using a task_struct and a timer directly. This makes psi triggering simpler by removing lists and locks involved with kthread_worker usage and eliminates the need for poll_scheduled atomic use in the hot path.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -153,9 +153,10 @@ struct psi_group { · 152 unmodified lines | ||
| 153 | 153 | unsigned long avg[NR_PSI_STATES - 1][3]; |
| 154 | 154 | |
| 155 | 155 | /* Monitor work control */ |
| 156 | − atomic_t poll_scheduled; | |
| 157 | − struct kthread_worker __rcu *poll_kworker; | |
| 158 | − struct kthread_delayed_work poll_work; | |
| 156 | + struct task_struct __rcu *poll_task; | |
| 157 | + struct timer_list poll_timer; | |
| 158 | + wait_queue_head_t poll_wait; | |
| 159 | + atomic_t poll_wakeup; | |
| 159 | 160 | |
| 160 | 161 | /* Protects data used by the monitor */ |
| 161 | 162 | struct mutex trigger_lock; |