Commit dd6c3c5
committed
workqueue: Move pwq_dec_nr_in_flight() to the end of work item handling
The planned shared nr_active handling for unbound workqueues will make
pwq_dec_nr_active() sometimes drop the pool lock temporarily to acquire
other pool locks, which is necessary as retirement of an nr_active count
from one pool may need kick off an inactive work item in another pool.
This patch moves pwq_dec_nr_in_flight() call in try_to_grab_pending() to the
end of work item handling so that work item state changes stay atomic.
process_one_work() which is the other user of pwq_dec_nr_in_flight() already
calls it at the end of work item handling. Comments are added to both call
sites and pwq_dec_nr_in_flight().
This shouldn't cause any behavior changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>1 parent 9f66cff commit dd6c3c5
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1587 | 1587 | | |
1588 | 1588 | | |
1589 | 1589 | | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
1590 | 1595 | | |
1591 | 1596 | | |
1592 | 1597 | | |
| |||
1711 | 1716 | | |
1712 | 1717 | | |
1713 | 1718 | | |
1714 | | - | |
1715 | 1719 | | |
1716 | 1720 | | |
1717 | 1721 | | |
1718 | 1722 | | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1719 | 1726 | | |
1720 | 1727 | | |
1721 | 1728 | | |
| |||
2780 | 2787 | | |
2781 | 2788 | | |
2782 | 2789 | | |
| 2790 | + | |
| 2791 | + | |
2783 | 2792 | | |
2784 | 2793 | | |
2785 | 2794 | | |
| |||
0 commit comments