All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] workqueue: reduce the sizeof pool_workqueue
@ 2020-06-01  8:44 Lai Jiangshan
  2020-06-01  8:44 ` [PATCH 1/4] workqueue: fix a piece of comment about reserved bits for work flags Lai Jiangshan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Lai Jiangshan @ 2020-06-01  8:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lai Jiangshan, Tejun Heo

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 <tj@kernel.org>

 include/linux/workqueue.h |  8 +++++++-
 kernel/workqueue.c        | 10 +++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-02 16:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01  8:44 [PATCH 0/4] workqueue: reduce the sizeof pool_workqueue Lai Jiangshan
2020-06-01  8:44 ` [PATCH 1/4] workqueue: fix a piece of comment about reserved bits for work flags Lai Jiangshan
2020-06-01  8:44 ` [PATCH 2/4] workqueue: use BUILD_BUG_ON() for compile time test instead of WARN_ON() Lai Jiangshan
2020-06-01 15:08   ` Tejun Heo
2020-06-01  8:44 ` [PATCH 3/4] workqueue: add a BUILD_BUG_ON() to check the size of struct pool_workqueue Lai Jiangshan
2020-06-01  8:44 ` [PATCH 4/4] workqueue: slash half memory usage in 32bit system Lai Jiangshan
2020-06-01 15:07   ` Tejun Heo
2020-06-02  0:08     ` Lai Jiangshan
2020-06-02 16:18       ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.