The watchdog_ts name doesn't convey what the timestamp actually tracks. This field tracks the last time a workqueue got progress. Rename it to last_progress_ts to make it clear that it records when the pool last made forward progress (started processing new work items). No functional change.
Showing the changes to kernel/workqueue.c (1 of 1 file). Show all
Unified · Split
| @@ -190,7 +190,7 @@ struct worker_pool { · 189 unmodified lines | ||
| 190 | 190 | int id; /* I: pool ID */ |
| 191 | 191 | unsigned int flags; /* L: flags */ |
| 192 | 192 | |
| 193 | − unsigned long watchdog_ts; /* L: watchdog timestamp */ | |
| 193 | + unsigned long last_progress_ts; /* L: last forward progress timestamp */ | |
| 194 | 194 | bool cpu_stall; /* WD: stalled cpu bound pool */ |
| 195 | 195 | |
| 196 | 196 | /* |
| @@ -1697,7 +1697,7 @@ static void __pwq_activate_work(struct pool_workqueue *pwq, · 1500 unmodified lines | ||
| 1697 | 1697 | WARN_ON_ONCE(!(*wdb & WORK_STRUCT_INACTIVE)); |
| 1698 | 1698 | trace_workqueue_activate_work(work); |
| 1699 | 1699 | if (list_empty(&pwq->pool->worklist)) |
| 1700 | − pwq->pool->watchdog_ts = jiffies; | |
| 1700 | + pwq->pool->last_progress_ts = jiffies; | |
| 1701 | 1701 | move_linked_works(work, &pwq->pool->worklist, NULL); |
| 1702 | 1702 | __clear_bit(WORK_STRUCT_INACTIVE_BIT, wdb); |
| 1703 | 1703 | } |
| @@ -2348,7 +2348,7 @@ retry: · 644 unmodified lines | ||
| 2348 | 2348 | */ |
| 2349 | 2349 | if (list_empty(&pwq->inactive_works) && pwq_tryinc_nr_active(pwq, false)) { |
| 2350 | 2350 | if (list_empty(&pool->worklist)) |
| 2351 | − pool->watchdog_ts = jiffies; | |
| 2351 | + pool->last_progress_ts = jiffies; | |
| 2352 | 2352 | |
| 2353 | 2353 | trace_workqueue_activate_work(work); |
| 2354 | 2354 | insert_work(pwq, work, &pool->worklist, work_flags); |
| @@ -3352,7 +3352,7 @@ static void process_scheduled_works(struct worker *worker) · 997 unmodified lines | ||
| 3352 | 3352 | while ((work = list_first_entry_or_null(&worker->scheduled, |
| 3353 | 3353 | struct work_struct, entry))) { |
| 3354 | 3354 | if (first) { |
| 3355 | − worker->pool->watchdog_ts = jiffies; | |
| 3355 | + worker->pool->last_progress_ts = jiffies; | |
| 3356 | 3356 | first = false; |
| 3357 | 3357 | } |
| 3358 | 3358 | process_one_work(worker, work); |
| @@ -4850,7 +4850,7 @@ static int init_worker_pool(struct worker_pool *pool) · 1491 unmodified lines | ||
| 4850 | 4850 | pool->cpu = -1; |
| 4851 | 4851 | pool->node = NUMA_NO_NODE; |
| 4852 | 4852 | pool->flags |= POOL_DISASSOCIATED; |
| 4853 | − pool->watchdog_ts = jiffies; | |
| 4853 | + pool->last_progress_ts = jiffies; | |
| 4854 | 4854 | INIT_LIST_HEAD(&pool->worklist); |
| 4855 | 4855 | INIT_LIST_HEAD(&pool->idle_list); |
| 4856 | 4856 | hash_init(pool->busy_hash); |
| @@ -6462,7 +6462,7 @@ static void show_one_worker_pool(struct worker_pool *pool) · 1605 unmodified lines | ||
| 6462 | 6462 | |
| 6463 | 6463 | /* How long the first pending work is waiting for a worker. */ |
| 6464 | 6464 | if (!list_empty(&pool->worklist)) |
| 6465 | − hung = jiffies_to_msecs(jiffies - pool->watchdog_ts) / 1000; | |
| 6465 | + hung = jiffies_to_msecs(jiffies - pool->last_progress_ts) / 1000; | |
| 6466 | 6466 | |
| 6467 | 6467 | /* |
| 6468 | 6468 | * Defer printing to avoid deadlocks in console drivers that |
| @@ -7691,7 +7691,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) · 1222 unmodified lines | ||
| 7691 | 7691 | touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, pool->cpu)); |
| 7692 | 7692 | else |
| 7693 | 7693 | touched = READ_ONCE(wq_watchdog_touched); |
| 7694 | − pool_ts = READ_ONCE(pool->watchdog_ts); | |
| 7694 | + pool_ts = READ_ONCE(pool->last_progress_ts); | |
| 7695 | 7695 | |
| 7696 | 7696 | if (time_after(pool_ts, touched)) |
| 7697 | 7697 | ts = pool_ts; |