diff options
author | 2024-01-29 08:11:24 -1000 | |
---|---|---|
committer | 2024-01-29 08:11:24 -1000 | |
commit | 1c270b79ce0b8290f146255ea9057243f6dd3c17 (patch) | |
tree | c53b4bc1b355895088126378b0eef1308db1ca94 /scripts/generate_rust_analyzer.py | |
parent | workqueue: Replace pwq_activate_inactive_work() with [__]pwq_activate_work() (diff) | |
download | linux-rng-1c270b79ce0b8290f146255ea9057243f6dd3c17.tar.xz linux-rng-1c270b79ce0b8290f146255ea9057243f6dd3c17.zip |
workqueue: Move nr_active handling into helpers
__queue_work(), pwq_dec_nr_in_flight() and wq_adjust_max_active() were
open-coding nr_active handling, which is fine given that the operations are
trivial. However, the planned unbound nr_active update will make them more
complicated, so let's move them into helpers.
- pwq_tryinc_nr_active() is added. It increments nr_active if under
max_active limit and return a boolean indicating whether inc was
successful. Note that the function is structured to accommodate future
changes. __queue_work() is updated to use the new helper.
- pwq_activate_first_inactive() is updated to use pwq_tryinc_nr_active() and
thus no longer assumes that nr_active is under max_active and returns a
boolean to indicate whether a work item has been activated.
- wq_adjust_max_active() no longer tests directly whether a work item can be
activated. Instead, it's updated to use the return value of
pwq_activate_first_inactive() to tell whether a work item has been
activated.
- nr_active decrement and activating the first inactive work item is
factored into pwq_dec_nr_active().
v3: - WARN_ON_ONCE(!WORK_STRUCT_INACTIVE) added to __pwq_activate_work() as
now we're calling the function unconditionally from
pwq_activate_first_inactive().
v2: - wq->max_active now uses WRITE/READ_ONCE() as suggested by Lai.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions