From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752782AbeARBmA (ORCPT ); Wed, 17 Jan 2018 20:42:00 -0500 Received: from out0-225.mail.aliyun.com ([140.205.0.225]:56243 "EHLO out0-225.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750948AbeARBl7 (ORCPT ); Wed, 17 Jan 2018 20:41:59 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01454;MF=yang.s@alibaba-inc.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---.AMUvxZo_1516239706; Subject: Re: [PATCH 2/2 v3] lib: debugobjects: touch watchdog to avoid softlockup when !CONFIG_PREEMPT To: Thomas Gleixner Cc: longman@redhat.com, linux-kernel@vger.kernel.org References: <1515023802-54196-1-git-send-email-yang.s@alibaba-inc.com> <1515023802-54196-2-git-send-email-yang.s@alibaba-inc.com> From: "Yang Shi" Message-ID: Date: Thu, 18 Jan 2018 09:41:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/17/18 4:21 AM, Thomas Gleixner wrote: > 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. Yes, sure. > >> @@ -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. I don't get your point here. objects free has already been done in a work. free_object() -> schedule_work() Do you mean free all of them out of the for loop in a batch? Then don't call free_object() in the for loop? > > 2) We can do a cond_resched() if not in atomic context and interrupts are > enabled. I did try this before I went with touching softlockup watchdog approach. The problem is in_atomic() can't tell if it is in atomic context on non-preempt kernel. For preempt kernel, it is easy. Thanks, Yang > > I rather prefer to make that stuff robust than having crystal ball > constants and magic debugfs knobs. > > Thanks, > > tglx >