Received: by 10.223.185.116 with SMTP id b49csp4940617wrg; Wed, 7 Mar 2018 03:49:34 -0800 (PST) X-Google-Smtp-Source: AG47ELsrWdOPaqGWb7rN/qjWaPEbhGNqLmmM+T3wCEiaBeV2DCE2Z6+AKHF4zhvdlwTebSsZgA7m X-Received: by 2002:a17:902:2de4:: with SMTP id p91-v6mr20300029plb.405.1520423374275; Wed, 07 Mar 2018 03:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520423374; cv=none; d=google.com; s=arc-20160816; b=elb6bkjitqY0SdjT0Xr4e7Lsa7zIkhTQcz7WBtgXdbtSiTZmR9y8QvZozNf6QyuRdl JatLSTa5NYBgn0DAKO/45BZuRiq1RimEvV4aFSV9VBe7Ff3iWA2+oWKVsxGjOmUIPfvX hxGEIIHc33rgxzzzEpv2II430Ka6gLjYvpdKXGJTJY6No6BHOs8UIb9D7S4jKEqukmpc nsZjnyNNAFnndGNwIp94HcnNOb66hG6kWKHsG0eEC1+tJuQ2p5d/OcbRVQKXD3Bm68Jw TfBc4XGdRit+53MSBCpgLNBtGt/FwCiWMsEmTO7lUiJxcriKId7sgexFHJpTVUTJgFkC ldyA== 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 :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=h5loXPHMePy4wydamS54kfQhRTCWBCrReOaQL4aJhwk=; b=EgEIXrEvcVuXYTzSsgtF1XBo9KfYAB45H8qn8nbZfFSlCT4rImWpt/Hf5XUuWhGkqr NRKiKCVdxcyX54bSnsh3HMfOWw2/qdiCeofZxiOIZKXxeJpODy5oqqJulPwYhs7B99XO 976PZv3i2kX/BnHdu5pUog72mPrvPheUE65gv9D3DvR3uVVTX4ycc0aCSyiTRCmFzjyx UCQC/xpD1rk9RLMRipkK2Y4m5eUyxUDlK/UH3QBBPM3ZrKGvvwLTCm4Ef8KC1CFFg8gU thMuykmlNVgKQJl2AKOB5CWQlI2tS3QjgE8+7ilEWHcAeyQ/VzVLe8QFyNXtTDAsGYgR nXig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=B4dHlCNE; dkim=pass header.i=@codeaurora.org header.s=default header.b=Mn/WM4YF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si12643197plv.604.2018.03.07.03.49.19; Wed, 07 Mar 2018 03:49:34 -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=@codeaurora.org header.s=default header.b=B4dHlCNE; dkim=pass header.i=@codeaurora.org header.s=default header.b=Mn/WM4YF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754318AbeCGLsP (ORCPT + 99 others); Wed, 7 Mar 2018 06:48:15 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:52120 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbeCGLsO (ORCPT ); Wed, 7 Mar 2018 06:48:14 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2E3DD60618; Wed, 7 Mar 2018 11:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520423294; bh=/8wqf9YwBZiEr6D5g+XJux/hQ45rEpOZJ8zJmgHEZ9U=; h=From:To:Cc:Subject:Date:From; b=B4dHlCNEqzo+ywCDEQm37ycjqGAmzwrQoptWV2qa3TcQE4z+wcSCBNbmfnJp59wlC 1MjR08j1fDd/C1z43gBA8ZWpwEKoByeWyaEKM00jAcqce/gImvL0egqFb8lPFLNL5L Usj6z7gLvXT/WHyt9WJV+jI96BRHgExMfAJQ6P2Q= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from cpandya-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1643B602A0; Wed, 7 Mar 2018 11:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520423293; bh=/8wqf9YwBZiEr6D5g+XJux/hQ45rEpOZJ8zJmgHEZ9U=; h=From:To:Cc:Subject:Date:From; b=Mn/WM4YFjkBJnOSfPwsXRAI29Qx90QkDhBqZEvrO/RIa5M1Ku5Vu+d2/MC/DvQMRW VdIP8/jyMs155vRPPduR5yjCKjymhCnPhtM/0bXBNYjVY0VkoFckiFW7F3orRuCSvj GdBnnWIm60+VJ363yT2zvtKd7plkEAZddAciVPao= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1643B602A0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org From: Chintan Pandya To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chintan Pandya Subject: [PATCH] slub: Fix misleading 'age' in verbose slub prints Date: Wed, 7 Mar 2018 17:17:46 +0530 Message-Id: <1520423266-28830-1-git-send-email-cpandya@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When SLUB_DEBUG catches the some issues, it prints all the required debug info being verbose. However, in few cases where allocation and free of the object has have happened in a very short time, 'age' might mislead. See the example below, [ 6044.137581] ============================================================================= [ 6044.145863] BUG kmalloc-256 (Tainted: G W O ): Poison overwritten [ 6044.152889] ----------------------------------------------------------------------------- [ 6044.152889] [ 6044.162618] INFO: 0xfffffff14956a878-0xfffffff14956a878. First byte 0x67 instead of 0x6b [ 6044.170804] INFO: Allocated in binder_transaction+0x4b0/0x2448 age=731 cpu=3 pid=5314 [ 6044.178711] __slab_alloc.isra.68.constprop.71+0x58/0x98 [ 6044.184070] kmem_cache_alloc_trace+0x198/0x2c4 [ 6044.188642] binder_transaction+0x4b0/0x2448 [ 6044.192953] binder_thread_write+0x998/0x1410 [ 6044.197350] binder_ioctl_write_read+0x130/0x370 [ 6044.202016] binder_ioctl+0x550/0x7dc [ 6044.205726] do_vfs_ioctl+0xcc/0x888 [ 6044.209510] SyS_ioctl+0x90/0xa4 [ 6044.212821] __sys_trace_return+0x0/0x4 [ 6044.216696] INFO: Freed in binder_free_transaction+0x2c/0x58 age=735 cpu=6 pid=2079 [ 6044.224415] kfree+0x28c/0x290 [ 6044.227505] binder_free_transaction+0x2c/0x58 [ 6044.231991] binder_transaction+0x1f78/0x2448 [ 6044.236392] binder_thread_write+0x998/0x1410 [ 6044.240789] binder_ioctl_write_read+0x130/0x370 [ 6044.245455] binder_ioctl+0x550/0x7dc [ 6044.249152] do_vfs_ioctl+0xcc/0x888 [ 6044.252772] SyS_ioctl+0x90/0xa4 [ 6044.256041] __sys_trace_return+0x0/0x4 [ 6044.259924] INFO: Slab 0xffffffbfc5255a00 objects=21 used=20 fp=0xfffffff14956a480 flags=0x4080 [ 6044.268695] INFO: Object 0xfffffff14956a780 @offset=10112 fp=0xfffffff149568680 ... [ 6044.494293] Object fffffff14956a870: 6b 6b 6b 6b 6b 6b 6b 6b 67 6b 6b 6b 6b 6b 6b a5 kkkkkkkkgkkkkkk. In this case, object got freed later but 'age' shows otherwise. This could be because, while printing this info, we print allocation traces first and free traces thereafter. In between, if we get schedule out, (jiffies - t->when) could become meaningless. So, simply print when the object was allocated/freed. Signed-off-by: Chintan Pandya --- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index e381728..b173f85 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -603,8 +603,8 @@ static void print_track(const char *s, struct track *t) if (!t->addr) return; - pr_err("INFO: %s in %pS age=%lu cpu=%u pid=%d\n", - s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid); + pr_err("INFO: %s in %pS when=%lu cpu=%u pid=%d\n", + s, (void *)t->addr, t->when, t->cpu, t->pid); #ifdef CONFIG_STACKTRACE { int i; -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project