Received: by 10.223.164.202 with SMTP id h10csp1383032wrb; Fri, 17 Nov 2017 20:44:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMaT1I95TBlfCNgmzG+YyZ1LHbekuEOy3X5ZlmJFsZs1eDW5ci5Cr/iba18pBUKvMkePOxWZ X-Received: by 10.99.117.83 with SMTP id f19mr6985395pgn.255.1510980247999; Fri, 17 Nov 2017 20:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510980247; cv=none; d=google.com; s=arc-20160816; b=PsneGBC50IdswoJfWf3jSM8bbsC+0eSQ96rsCXie7kZz8rtwJfz2OVA9PqCzPz1N/o OhrfikANXNcbqJ8XaM5jge8msrYZnQ/968L2CeUqI8gPppH/mvmNzGQ3wzASjz87JfUi r79NjAM9syIXxOfMOHvtR+W7Fb2tGFhuos+dJosoux4f4m1Gs4VAD/Qfpe1DFw2ZshkY TlGaVj7btvVsfhK8BUZnSTRpqyNu3zp8oNaa8kNYwfbNloHBkQAsNlEPnVnX3Os918cH N7O+qZPHHdzo3J8eJrqIDr59ytjlKa/dV4fKOOc11wxA8rMnZ5a9AFGggJzOMl8HX4TF qUHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ExLKUrRpbUC1fpFBSAV+ySnoJz+CGbouSAjE+9GTIOA=; b=NTzdvZprKSAXMZWr7U4s6C0/0+QUFBIS4cXbWJeqYW+bh1AEeFDs9FsXfSPEMH14t5 esICArK39DH2jGr05fXx6oUGaMdF7kWbbktkxWlbGkYLFSm2Kn0L01KmeYk1ZEAfdomF CEXNomoCQ8zNhxSRLHmLe/VCP6kdwXbA0Ep3g1atdGrn6EgeKLT7hLSukCazP4Ec0Z3H pmTSWO79Ivvg90a02CaxRZDbgtc4MaI0jML9N5x82D2NUgMV3xg8p2IVjpHXNe5tCct/ ayBSSTpWu3qR7EcttSkTMIy7hdER7V8MeL1JjCHJqMHtDlgTPOfgEC1vQZ/QSMbW2HsK D6Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alibaba-inc.com header.s=default header.b=LQ19ev6L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba-inc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si3969356pld.82.2017.11.17.20.43.55; Fri, 17 Nov 2017 20:44:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alibaba-inc.com header.s=default header.b=LQ19ev6L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba-inc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935425AbdKQToN (ORCPT + 93 others); Fri, 17 Nov 2017 14:44:13 -0500 Received: from out0-236.mail.aliyun.com ([140.205.0.236]:55358 "EHLO out0-236.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362AbdKQToG (ORCPT ); Fri, 17 Nov 2017 14:44:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1510947842; h=From:To:Subject:Date:Message-Id; bh=ExLKUrRpbUC1fpFBSAV+ySnoJz+CGbouSAjE+9GTIOA=; b=LQ19ev6LFUE2rXqQUmfOz0QnwUaIpditop7iuTeWtCWfWlWYKAJy4exlLHGD7gViQXj7PbRwrQZPKK4baUuKh71ig1gI4x8Ai4FH+JbQVSH9KNmengv5lTRF/xB4gZW9VywKxrB9iTIUNE4ga/c1VQLZDU+SbUgoR2Qex7QK0Yw= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R581e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03278;MF=yang.s@alibaba-inc.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---.9RBXktw_1510947833; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.s@alibaba-inc.com fp:106.11.237.142) by smtp.aliyun-inc.com(127.0.0.1); Sat, 18 Nov 2017 03:44:00 +0800 From: "Yang Shi" To: tglx@linutronix.de Cc: "Yang Shi" , Subject: [RFC PATCH 1/2] lib: debugobjects: export max loops counter Date: Sat, 18 Nov 2017 03:43:52 +0800 Message-Id: <1510947833-116482-1-git-send-email-yang.s@alibaba-inc.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently max chain counter is exported to sysfs, it just record the counter of inner loop, however, there might be significant iterations of external loop then it may take significant amount of time to finish all of the checks. This may cuase lockup on !CONFIG_PREEMPT kernel build occasionally. Record the counter of the max loops then export to sysfs so that the user can be aware of the real overhead. Then the output of /sys/kernel/debug/debug_objects/stats looks like: max_chain :121 max_loops :543267 warnings :0 fixups :0 pool_free :1764 pool_min_free :341 pool_used :86438 pool_max_used :268887 objs_allocated:6068254 objs_freed :5981076 Signed-off-by: Yang Shi --- lib/debugobjects.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 2f5349c..166488d 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -50,6 +50,7 @@ struct debug_bucket { static struct kmem_cache *obj_cache; static int debug_objects_maxchain __read_mostly; +static int debug_objects_maxloops __read_mostly; static int debug_objects_fixups __read_mostly; static int debug_objects_warnings __read_mostly; static int debug_objects_enabled __read_mostly @@ -720,7 +721,7 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size) enum debug_obj_state state; struct debug_bucket *db; struct debug_obj *obj; - int cnt; + int cnt, max_loops = 0; saddr = (unsigned long) address; eaddr = saddr + size; @@ -765,7 +766,12 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size) if (cnt > debug_objects_maxchain) debug_objects_maxchain = cnt; + + max_loops += cnt; } + + if (max_loops > debug_objects_maxloops) + debug_objects_maxloops = max_loops; } void debug_check_no_obj_freed(const void *address, unsigned long size) @@ -780,6 +786,7 @@ void debug_check_no_obj_freed(const void *address, unsigned long size) static int debug_stats_show(struct seq_file *m, void *v) { seq_printf(m, "max_chain :%d\n", debug_objects_maxchain); + seq_printf(m, "max_loops :%d\n", debug_objects_maxloops); seq_printf(m, "warnings :%d\n", debug_objects_warnings); seq_printf(m, "fixups :%d\n", debug_objects_fixups); seq_printf(m, "pool_free :%d\n", obj_pool_free); -- 1.8.3.1 From 1585234657545052247@xxx Mon Nov 27 15:46:18 +0000 2017 X-GM-THRID: 1585234657545052247 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread