mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Qian Cai <cai@gmx.us>
Cc: Waiman Long <longman@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	arnd@arndb.de, linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] debugobjects: scale the static pool size
Date: Mon, 26 Nov 2018 10:50:05 +0000	[thread overview]
Message-ID: <20181126105005.GA33554@arrakis.emea.arm.com> (raw)
In-Reply-To: <0cba9054-99dd-9dbe-3da8-e10d25752c5b@gmx.us>

On Mon, Nov 26, 2018 at 04:45:54AM -0500, Qian Cai wrote:
> On 11/25/18 11:52 PM, Qian Cai wrote:
> > BTW, calling debug_objects_mem_init() before kmemleak_init() actually
> > could trigger a loop on machines with 160+ CPUs until the pool is filled
> > up,
> > 
> > debug_objects_pool_min_level += num_possible_cpus() * 4;
> > 
> > [1] while (obj_pool_free < debug_objects_pool_min_level)
> > 
> > kmemleak_init
> >    kmemleak_ignore (from replaced static debug objects)
> >      make_black_object
> >        put_object
> >          __call_rcu (kernel/rcu/tree.c)
> >            debug_rcu_head_queue
> >              debug_object_activate
> >                debug_object_init
> >                  fill_pool
> >                    kmemleak_ignore (looping in [1])
> >                      make_black_object
> >                        ...
> > 
> > I think until this is resolved, there is no way to move
> > debug_objects_mem_init() before kmemleak_init().
> 
> I believe this is a separate issue that kmemleak is broken with
> CONFIG_DEBUG_OBJECTS_RCU_HEAD anyway where the infinite loop above could be
> triggered in the existing code as well, i.e., once the pool need be refilled
> (fill_pool()) after the system boot up, debug object creation will call
> kmemleak_ignore() and it will create a new rcu debug_object_init(), and then
> it will call fill_pool() again and again. As the results, the system is
> locking up during kernel compilations.
> 
> Hence, I'll send out a patch for debug objects with large CPUs anyway and
> deal with kmemleak + CONFIG_DEBUG_OBJECTS_RCU_HEAD issue later.

I haven't hit this before but I can see why it happens. Kmemleak uses
RCU for freeing its own data structures to avoid a recursive call to
sl*b (kmem_cache_free()). Since we already tell kmemleak to ignore the
debug_objects_cache allocations, I think we could as well add
SLAB_NOLEAKTRACE to kmem_cache_create() (I haven't tried yet, this was
not a documented API for kmemleak, rather used to avoid kmemleak
tracking itself).

-- 
Catalin

  reply	other threads:[~2018-11-26 10:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 20:14 [PATCH v2] " Qian Cai
2018-11-20 20:54 ` Waiman Long
2018-11-20 20:56   ` Thomas Gleixner
2018-11-20 23:28 ` [PATCH v3] " Qian Cai
2018-11-20 23:38   ` Waiman Long
2018-11-20 23:54     ` Qian Cai
2018-11-20 23:58       ` Joe Perches
2018-11-21  2:11   ` [PATCH v4] " Qian Cai
2018-11-21 14:45     ` Waiman Long
2018-11-22 21:56     ` Thomas Gleixner
2018-11-23  4:31       ` [PATCH] debugobjects: call debug_objects_mem_init eariler Qian Cai
2018-11-23  4:59         ` Waiman Long
2018-11-23 21:46           ` Thomas Gleixner
2018-11-24  2:54             ` Qian Cai
2018-11-24  3:01       ` [PATCH v4] debugobjects: scale the static pool size Qian Cai
2018-11-25 20:42         ` Qian Cai
2018-11-26  1:31           ` Waiman Long
2018-11-26  4:52             ` Qian Cai
2018-11-26  9:45               ` Qian Cai
2018-11-26 10:50                 ` Catalin Marinas [this message]
2018-11-25 20:48       ` Qian Cai

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=20181126105005.GA33554@arrakis.emea.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=cai@gmx.us \
    --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®