From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752828AbeAQMVv (ORCPT + 1 other); Wed, 17 Jan 2018 07:21:51 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:45837 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752268AbeAQMVu (ORCPT ); Wed, 17 Jan 2018 07:21:50 -0500 Date: Wed, 17 Jan 2018 13:21:45 +0100 (CET) From: Thomas Gleixner To: Yang Shi cc: longman@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2 v3] lib: debugobjects: touch watchdog to avoid softlockup when !CONFIG_PREEMPT In-Reply-To: <1515023802-54196-2-git-send-email-yang.s@alibaba-inc.com> Message-ID: References: <1515023802-54196-1-git-send-email-yang.s@alibaba-inc.com> <1515023802-54196-2-git-send-email-yang.s@alibaba-inc.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, 4 Jan 2018, Yang Shi wrote: > There are nested loops on debug objects free path, sometimes it may take > over hundred thousands of loops, then cause soft lockup with !CONFIG_PREEMPT > occasionally, like below: Please trim back traces. The whole module info and whatever is completely irrelevant. > @@ -768,6 +771,10 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size) > debug_objects_maxchain = cnt; > > max_loops += cnt; > + > + if (max_loops > 10000 && ((max_loops % 10000) == 0) > + && suppress_lockup != 0) > + touch_softlockup_watchdog(); This is voodoo programming. There are two things which can be done here: 1) The collected objects can be put on a global free list and work scheduled to free them piecewise. 2) We can do a cond_resched() if not in atomic context and interrupts are enabled. I rather prefer to make that stuff robust than having crystal ball constants and magic debugfs knobs. Thanks, tglx