Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7578928rwr; Tue, 25 Apr 2023 15:41:40 -0700 (PDT) X-Google-Smtp-Source: AKy350Zvc+dvv8mxV11qgHd6y+eEf+3NoPfOj0kn7rtrNz+tbh5p56n8FwlBBgYcL6Fta1US7Hqp X-Received: by 2002:a17:90a:e2d1:b0:24b:af7c:4626 with SMTP id fr17-20020a17090ae2d100b0024baf7c4626mr9325815pjb.16.1682462500386; Tue, 25 Apr 2023 15:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682462500; cv=none; d=google.com; s=arc-20160816; b=gungXjI1sLeIkWlUJaRoqMAyloEjgULRzHxlSKA0E3uX16SHDhNXXS9kIYddU4/S2b +PeJZC9wFG+G8g/07tXU/41eN1Apl42LUIVtewnc/yf4l9FT1fJCp+FKFH2sYabnI91n iaFnN36yXAwOIP/w1WXIi46itThh8zMSCg1rsJVSTqOzAweR7ds4J36TvCv5Fdfc5o9X 7aC+vtuVNCtm2iilvKuWcFLIgiCXKyhpORRACE6FxHHpP/USqjn3zuhdHOuk1pF8LOsU lTiZVuxhkEohr1zyQakFlOwLHcqJri4mCGLwW21SWaGbDW9Ck7DA7O0NL1jijbTg35f8 8eJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=72+eO6KwavTo94Q3dwD5X6q19DNV6pOCYjiHiYVA/Vw=; b=Rmz4Ubf372wOnP+QR0AMw5cXkRHrp3as0k9YnfJ89HVmlyom47tmYIPLOGWPdTG5qV j+9xCanqb+822ohe9NoX3U+340hKPoM5rBBJIkorKAw8DPgDyO4rc/ufwtqBdAOXGc9f cMCbl8yxEQNguhQaUfJzTaXLZ0IVxC/veWAGmswxuVfs91PxqqvtWGEkNZeuta/JXGAR Gt0c0PH4WfRm0FAhqbHORILiRbynetsdZ/5NmZVarq1zKANbJBu292luSRDLCPMfMXMz odL+VoxaKE15utiC1066QAOGOTKWneb7KoTh/mmMN9dl7bPniSm0McThRXD0jSvEq0GW 10SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Grk8Bdno; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a654847000000b0051b1542d6efsi14317191pgs.213.2023.04.25.15.41.29; Tue, 25 Apr 2023 15:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Grk8Bdno; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236377AbjDYWZA (ORCPT + 99 others); Tue, 25 Apr 2023 18:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236190AbjDYWY6 (ORCPT ); Tue, 25 Apr 2023 18:24:58 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 636DB5FF1 for ; Tue, 25 Apr 2023 15:24:57 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-76355514e03so549679739f.0 for ; Tue, 25 Apr 2023 15:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682461496; x=1685053496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=72+eO6KwavTo94Q3dwD5X6q19DNV6pOCYjiHiYVA/Vw=; b=Grk8BdnodSaCw+q2KEGxiYiB/BWivAhKBG3jYwZhxGLowfMkRBXpthNBz0x+pd+T3P 6CAtDSNrOHaEJsadCy0ZB8775sPskCbqboCd8pgull+tCAZAhHrSBr2yYvnChZ429l1W aNLhgWELCQPxiDcM9nKlOy4UJVJqEDTGoYpug3z4DVq5egXl9vztA77qAbCwgUwqoInQ 7ZYsWmtZ80pXz/WM7d2RuwccAsEaNdfmcMISDUD4XhhkFwyBq8TeJFRqYqN9kxZlR3KB 5bD+ekaggIS6DwCjFeDGRUXZP6rxMkCM3/nmhEJGxgEO4NP6+N5SRHHBKImsVGhgq95e SMMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682461496; x=1685053496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=72+eO6KwavTo94Q3dwD5X6q19DNV6pOCYjiHiYVA/Vw=; b=CSMmm/OxKtL+S1gAsG/rjyfCZkx9GIot2TBNsp9o/sQ9idi8CIfF1RxEsWh/9ZzvMx aINQMGuhqWobjWUWZRuCi29zjrUmJEGr0kWeLwnPRYxqgfVfcVqR+h469qaWV98sLkOV B3LsP3NxPVl0qBHZoJRYZm4eicriNDfA911B6nAuGi6lWxAt2XCqPRggKwmixTPdGyhN Y1KNcj+MSeOIt7HTOY8XhWfL4CQIUuP5kA9cx6261lOK8w6U90vkFkQJbheSyqeubSsV I4oDiID8AHWaaR+2SvPXmf3wr3QqatoaB/Ld6w7CGTQue6l1SLa1AyVJD08oEunpRBhc xsLw== X-Gm-Message-State: AAQBX9codZ9ky4Cj7tIhET23yAxelcQKcbiX2SBMm4iudc6pLHc+AZED mySTVIGGYDsofW6FSyTf20MGCtvkRRE= X-Received: by 2002:a92:c809:0:b0:328:bfbd:1e87 with SMTP id v9-20020a92c809000000b00328bfbd1e87mr8356225iln.27.1682461496560; Tue, 25 Apr 2023 15:24:56 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id 13-20020a92180d000000b003244d7f2292sm3833008ily.32.2023.04.25.15.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 15:24:56 -0700 (PDT) From: Jim Cromie To: catalin.marinas@arm.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Jim Cromie Subject: [PATCH 1/3] kmemleak: drop (age ) from leak record Date: Tue, 25 Apr 2023 16:24:44 -0600 Message-Id: <20230425222446.170486-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425222446.170486-1-jim.cromie@gmail.com> References: <20230425222446.170486-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Displaying age is pretty, but counter-productive; it surrenders idempotency of the output, which breaks simple hash-based cataloging of the records by the user. The trouble: sequential reads, wo new leaks, get new results: :#> sum /sys/kernel/debug/kmemleak 53439 74 /sys/kernel/debug/kmemleak :#> sum /sys/kernel/debug/kmemleak 59066 74 /sys/kernel/debug/kmemleak and age is why (nothing else changes): :#> grep -v age /sys/kernel/debug/kmemleak | sum 58894 67 :#> grep -v age /sys/kernel/debug/kmemleak | sum 58894 67 Further, age is not an intrinsic property of the leak, its an artifact of when it was scanned, and relative age is embedded in leak order. While userspace could work around the always-changing output, ISTM none could be relying upon age in any important way, and having idempotent output is just better. Signed-off-by: Jim Cromie --- mm/kmemleak.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index a2d34226e3c8..f025c7bc845b 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -355,14 +355,12 @@ static void print_unreferenced(struct seq_file *seq, int i; unsigned long *entries; unsigned int nr_entries; - unsigned int msecs_age = jiffies_to_msecs(jiffies - object->jiffies); nr_entries = stack_depot_fetch(object->trace_handle, &entries); warn_or_seq_printf(seq, "unreferenced object 0x%08lx (size %zu):\n", object->pointer, object->size); - warn_or_seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu (age %d.%03ds)\n", - object->comm, object->pid, object->jiffies, - msecs_age / 1000, msecs_age % 1000); + warn_or_seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu\n", + object->comm, object->pid, object->jiffies); hex_dump_object(seq, object); warn_or_seq_printf(seq, " backtrace:\n"); -- 2.40.0