Skip to content

workqueue: reduce the sizeof pool_workqueue

Lai Jiangshan lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4workqueue: fix a piece of comment about reserved bits for work flagsinclude/linux/workqueue.h+1 -10 replies
2/4workqueue: use BUILD_BUG_ON() for compile time test instead of WARN_ON()kernel/workqueue.c+1 -11 reply
3/4workqueue: add a BUILD_BUG_ON() to check the size of struct pool_workqueuekernel/workqueue.c+8 -00 replies
4/4workqueue: slash half memory usage in 32bit systeminclude/linux/workqueue.h+6 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] workqueue: reduce the sizeof pool_workqueue

The major memory ussage in workqueue is on the pool_workqueue. The pool_workqueue has alignment requirement which often leads to padding.

Reducing the memory usage for the pool_workqueue is valuable.

And 32bit system often has less memory, less workqueues, less works, less concurrent flush_workqueue()s, so we can slash the flush color on 32bit system to reduce memory usage

Before patch:
The sizeof the struct pool_workqueue is 256 bytes, only 136 bytes is in use in 32bit system

After patch:
The sizeof the struct pool_workqueue is 128 bytes, only 104 bytes is in use in 32bit system, there is still room for future usage.

Setting WORK_STRUCT_COLOR_BITS to 3 can't reduce the sizeof the struct pool_workqueue in 64bit system, unless combined with big refactor for unbound pwq.

Lai Jiangshan (4):
workqueue: fix a piece of comment about reserved bits for work flags
workqueue: use BUILD_BUG_ON() for compile time test instead of

    WARN_ON()

workqueue: add a BUILD_BUG_ON() to check the size of struct
pool_workqueue
workqueue: slash half memory usage in 32bit system

Cc Tejun Heo <[email protected]>
 include/linux/workqueue.h |  8 +++++++-
 kernel/workqueue.c        | 10 +++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
Signature · 1 line
2.20.1