History

workqueue: Rename pool->watchdog_ts to pool->last_progress_ts

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.

Breno Leitao committed 8 months ago

Commit 60371601 parent f42f9091 file · +7 −7Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+7−7
@@ -190,7 +190,7 @@ struct worker_pool { · 189 unmodified lines
190 int id; /* I: pool ID */190 int id; /* I: pool ID */
191 unsigned int flags; /* L: flags */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 bool cpu_stall; /* WD: stalled cpu bound pool */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 WARN_ON_ONCE(!(*wdb & WORK_STRUCT_INACTIVE));1697 WARN_ON_ONCE(!(*wdb & WORK_STRUCT_INACTIVE));
1698 trace_workqueue_activate_work(work);1698 trace_workqueue_activate_work(work);
1699 if (list_empty(&pwq->pool->worklist))1699 if (list_empty(&pwq->pool->worklist))
1700 pwq->pool->watchdog_ts = jiffies;1700 pwq->pool->last_progress_ts = jiffies;
1701 move_linked_works(work, &pwq->pool->worklist, NULL);1701 move_linked_works(work, &pwq->pool->worklist, NULL);
1702 __clear_bit(WORK_STRUCT_INACTIVE_BIT, wdb);1702 __clear_bit(WORK_STRUCT_INACTIVE_BIT, wdb);
1703}1703}
@@ -2348,7 +2348,7 @@ retry: · 644 unmodified lines
2348 */2348 */
2349 if (list_empty(&pwq->inactive_works) && pwq_tryinc_nr_active(pwq, false)) {2349 if (list_empty(&pwq->inactive_works) && pwq_tryinc_nr_active(pwq, false)) {
2350 if (list_empty(&pool->worklist))2350 if (list_empty(&pool->worklist))
2351 pool->watchdog_ts = jiffies;2351 pool->last_progress_ts = jiffies;
2352 2352
2353 trace_workqueue_activate_work(work);2353 trace_workqueue_activate_work(work);
2354 insert_work(pwq, work, &pool->worklist, work_flags);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 while ((work = list_first_entry_or_null(&worker->scheduled,3352 while ((work = list_first_entry_or_null(&worker->scheduled,
3353 struct work_struct, entry))) {3353 struct work_struct, entry))) {
3354 if (first) {3354 if (first) {
3355 worker->pool->watchdog_ts = jiffies;3355 worker->pool->last_progress_ts = jiffies;
3356 first = false;3356 first = false;
3357 }3357 }
3358 process_one_work(worker, work);3358 process_one_work(worker, work);
@@ -4850,7 +4850,7 @@ static int init_worker_pool(struct worker_pool *pool) · 1491 unmodified lines
4850 pool->cpu = -1;4850 pool->cpu = -1;
4851 pool->node = NUMA_NO_NODE;4851 pool->node = NUMA_NO_NODE;
4852 pool->flags |= POOL_DISASSOCIATED;4852 pool->flags |= POOL_DISASSOCIATED;
4853 pool->watchdog_ts = jiffies;4853 pool->last_progress_ts = jiffies;
4854 INIT_LIST_HEAD(&pool->worklist);4854 INIT_LIST_HEAD(&pool->worklist);
4855 INIT_LIST_HEAD(&pool->idle_list);4855 INIT_LIST_HEAD(&pool->idle_list);
4856 hash_init(pool->busy_hash);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 /* How long the first pending work is waiting for a worker. */6463 /* How long the first pending work is waiting for a worker. */
6464 if (!list_empty(&pool->worklist))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 * Defer printing to avoid deadlocks in console drivers that6468 * 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 touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, pool->cpu));7691 touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, pool->cpu));
7692 else7692 else
7693 touched = READ_ONCE(wq_watchdog_touched);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 if (time_after(pool_ts, touched))7696 if (time_after(pool_ts, touched))
7697 ts = pool_ts;7697 ts = pool_ts;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t