All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] debugobjects: Reduce global pool_lock contention
@ 2019-05-20 14:14 Waiman Long
  2019-05-20 14:14 ` [PATCH 1/5] debugobjects: Add percpu free pools Waiman Long
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Waiman Long @ 2019-05-20 14:14 UTC (permalink / raw)
  To: Thomas Gleixner, Andrew Morton
  Cc: linux-kernel, Yang Shi, Joel Fernandes (Google),
	Qian Cai, Zhong Jiang, Waiman Long

Many large workloads require the kernel to acquire a lot of objects
and then free them when the work is done. When the debug objects code
is configured, this will cause a lot of debug objects to be allocated and
then free later on. For instance, after a kernel boot up and 3 parallel
kernel builds, the partial output of the debug objects stats file was:

  pool_free     :3082
  pool_min_free :498
  pool_used     :108488
  pool_max_used :170127
  on_free_list  :0
  objs_allocated:34954917
  objs_freed    :34844371

It can be seen that a lot of debug objects were allocated and freed
during those operations. All these debug object allocation and free
operations require grabbing the global pool_lock. On systems with many
CPUs, the contention on this single global lock can become one of the
bottlenecks.

This patchset tries to reduce the level of contention on this global
pool_lock by the following means:
 1) Add a percpu free object pool to serve as a cache so that object
    allocation and freeing can be done without acquiring pool_lock when
    is not empty or full.
 2) Batching up multiple operations in a single lock/unlock critical
    section to reduce the number of times the pool_lock is to be
    acquired.
 3) Make the actual freeing of the debug objects via the workqueue less
    aggressive to minimize the actual number of slab allocation and
    freeing calls.

In addition, this patchset also tries to move the printk() call out
of the raw db->lock critical section to reduce the lock hold time as
much as possible.

With or without these changes, the times to do a parallel kernel build
on a 2-socket 36-core 72-thread Haswell system were:

   Kernel         Elapsed time      System time
   ------         ------------      -----------
   Pre-patch        4m51.01s         83m11.53s
   Post-patch       4m47.45s         80m25.78s

The post-patch partial debug objects stats file for the same operations
was:

  pool_free     :5901
  pool_pcp_free :3742
  pool_min_free :1022
  pool_used     :104805
  pool_max_used :168081
  on_free_list  :0
  objs_allocated:5796864
  objs_freed    :5687182

Waiman Long (5):
  debugobjects: Add percpu free pools
  debugobjects: Percpu pool lookahead freeing/allocation
  debugobjects: Reduce number of pool_lock acquisitions in fill_pool()
  debugobjects: Less aggressive freeing of excess debug objects
  debugobjects: Move printk out of db lock critical sections

 lib/debugobjects.c | 308 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 252 insertions(+), 56 deletions(-)

-- 
2.18.1


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

end of thread, other threads:[~2019-06-14 13:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 14:14 [PATCH 0/5] debugobjects: Reduce global pool_lock contention Waiman Long
2019-05-20 14:14 ` [PATCH 1/5] debugobjects: Add percpu free pools Waiman Long
2019-06-14 12:58   ` [tip:core/debugobjects] " tip-bot for Waiman Long
2019-05-20 14:14 ` [PATCH 2/5] debugobjects: Percpu pool lookahead freeing/allocation Waiman Long
2019-06-14 12:59   ` [tip:core/debugobjects] " tip-bot for Waiman Long
2019-05-20 14:14 ` [PATCH 3/5] debugobjects: Reduce number of pool_lock acquisitions in fill_pool() Waiman Long
2019-06-14 13:00   ` [tip:core/debugobjects] " tip-bot for Waiman Long
2019-05-20 14:14 ` [PATCH 4/5] debugobjects: Less aggressive freeing of excess debug objects Waiman Long
2019-06-14 13:01   ` [tip:core/debugobjects] " tip-bot for Waiman Long
2019-05-20 14:14 ` [PATCH 5/5] debugobjects: Move printk out of db lock critical sections Waiman Long
2019-06-14 13:01   ` [tip:core/debugobjects] debugobjects: Move printk out of db->lock " tip-bot for Waiman Long

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.