All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Waiman Long <longman@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/kmemleak: Avoid soft lockup in __kmemleak_do_cleanup()
Date: Wed, 30 Jul 2025 11:03:24 +0100	[thread overview]
Message-ID: <aInt7Fa6N7Y3zW_K@arm.com> (raw)
In-Reply-To: <20250728190248.605750-1-longman@redhat.com>

On Mon, Jul 28, 2025 at 03:02:48PM -0400, Waiman Long wrote:
> A soft lockup warning was observed on a relative small system x86-64
> system with 16 GB of memory when running a debug kernel with kmemleak
> enabled.
> 
>   watchdog: BUG: soft lockup - CPU#8 stuck for 33s! [kworker/8:1:134]
> 
> The test system was running a workload with hot unplug happening
> in parallel. Then kemleak decided to disable itself due to its
> inability to allocate more kmemleak objects. The debug kernel has its
> CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE set to 40,000.
> 
> The soft lockup happened in kmemleak_do_cleanup() when the existing
> kmemleak objects were being removed and deleted one-by-one in a loop
> via a workqueue. In this particular case, there are at least 40,000
> objects that need to be processed and given the slowness of a debug
> kernel and the fact that a raw_spinlock has to be acquired and released
> in __delete_object(), it could take a while to properly handle all
> these objects.
> 
> As kmemleak has been disabled in this case, the object removal and
> deletion process can be further optimized as locking isn't really
> needed. However, it is probably not worth the effort to optimize for
> such an edge case that should rarely happen. So the simple solution is
> to call cond_resched() at periodic interval in the iteration loop to
> avoid soft lockup.
> 
> Signed-off-by: Waiman Long <longman@redhat.com>

I agree, it's not worth rewriting this path for an unlikely event. So
I'm fine with this approach. Thanks.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


      reply	other threads:[~2025-07-30 10:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 19:02 [PATCH] mm/kmemleak: Avoid soft lockup in __kmemleak_do_cleanup() Waiman Long
2025-07-30 10:03 ` Catalin Marinas [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=aInt7Fa6N7Y3zW_K@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.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 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.