mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qian Cai <cai@gmx.us>
To: akpm@linux-foundation.org, tglx@linutronix.de
Cc: longman@redhat.com, yang.shi@linux.alibaba.com, arnd@arndb.de,
	linux-kernel@vger.kernel.org, Qian Cai <cai@gmx.us>
Subject: [PATCH v2] debugobjects: add a new Kconfig for POOL_SIZE
Date: Sun, 18 Nov 2018 17:08:51 -0500	[thread overview]
Message-ID: <20181118220851.942-1-cai@gmx.us> (raw)
In-Reply-To: <20181118082255.1275-1-cai@gmx.us>

The current value of ODEBUG_POOL_SIZE is not big enough for systems with
large number of CPUs with timer or/and workqueue objects because during
the early boot, timer objects needs the size equals to

No. CPUs x 2 (worker pool)

start_kernel
  workqueue_init_early
    init_worker_pool
      init_timer_key
        debug_object_init

puls, No. CPUs (if have the hrtimer option)

start_kernel
  sched_init
    hrtick_rq_init
      hrtimer_init
        debug_object_init

Then, workqueue objects requires even more,

No. CPUs x 6 (workqueue)

start_kernel
  workqueue_init_early
    alloc_workqueue
      __alloc_workqueue_key
        alloc_and_link_pwqs
          init_pwq
            debug_object_init

plus, No, CPUs x 2 (worker pool) (if have the perf option)

start_kernel
  perf_event_init
    __init_srcu_struct
      init_srcu_struct_fields
        __init_work
          debug_object_init

As the results, systems have 60+ CPUs with both timer and workqueue
objects enabled could trigger "ODEBUG: Out of memory. ODEBUG disabled".

Hence, add a new Kconfig option so users could adjust ODEBUG_POOL_SIZE
accordingly if either timer or workqueue objects are selected.

Signed-off-by: Qian Cai <cai@gmx.us>
---

Changes since v1:
* Fixed a few typos.
* Added missing call stacks.
* Removed implementation details from the Kconfig help.

 lib/Kconfig.debug  | 11 +++++++++++
 lib/debugobjects.c |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 1af29b8224fd..0749dc627eb5 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -449,6 +449,17 @@ config DEBUG_OBJECTS
 	  kernel to track the life time of various objects and validate
 	  the operations on those objects.
 
+config DEBUG_OBJECTS_POOL_SIZE
+	int "Debug objects pool size"
+	depends on DEBUG_OBJECTS_TIMERS || DEBUG_OBJECTS_WORK
+	default 1024
+	help
+	  Some debug objects are allocated during the early boot. Enabling some
+	  options below like timers or workqueue objects may increase the size
+	  required significantly with large number of CPUs. If the kernel
+	  reports "ODEBUG: Out of memory. ODEBUG disabled", please increase
+	  this value.
+
 config DEBUG_OBJECTS_SELFTEST
 	bool "Debug objects selftest"
 	depends on DEBUG_OBJECTS
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 70935ed91125..b0e8e90f6ad1 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -23,7 +23,11 @@
 #define ODEBUG_HASH_BITS	14
 #define ODEBUG_HASH_SIZE	(1 << ODEBUG_HASH_BITS)
 
+#ifdef CONFIG_DEBUG_OBJECTS_POOL_SIZE
+#define ODEBUG_POOL_SIZE	CONFIG_DEBUG_OBJECTS_POOL_SIZE
+#else
 #define ODEBUG_POOL_SIZE	1024
+#endif
 #define ODEBUG_POOL_MIN_LEVEL	256
 
 #define ODEBUG_CHUNK_SHIFT	PAGE_SHIFT
-- 
2.17.2 (Apple Git-113)


      parent reply	other threads:[~2018-11-18 22:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-18  8:22 [PATCH] " Qian Cai
2018-11-18 18:21 ` Thomas Gleixner
2018-11-18 18:56   ` Qian Cai
2018-11-19  8:09     ` Thomas Gleixner
2018-11-19 13:27       ` Qian Cai
2018-11-19 14:51         ` Waiman Long
2018-11-19 15:17           ` Qian Cai
2018-11-19 16:19             ` Waiman Long
2018-11-19 16:25               ` Thomas Gleixner
2018-11-19 16:32                 ` Qian Cai
2018-11-18 22:08 ` Qian Cai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181118220851.942-1-cai@gmx.us \
    --to=cai@gmx.us \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=yang.shi@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®