Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2203075ybl; Thu, 5 Dec 2019 13:56:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwasBjYptjQ3KhvzCoKYadV+vst7YnQEC8MXMEymvcnGaNxlR+N0tSQ8x9VfJKHNCRr62e+ X-Received: by 2002:aca:d483:: with SMTP id l125mr9170928oig.124.1575582986083; Thu, 05 Dec 2019 13:56:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575582986; cv=none; d=google.com; s=arc-20160816; b=HpQ3iripJRaEEYC7W97raUEv6KRDgAsOz+CoRl+npoSDtxABw0tvFrcpInVRipuGfD Tass6cdQtprFfVqeCHs140Giizi1mzBP1FwLcgx9EdzD742GDC4S7djyeiTQo2vKyMAR hdkFrMkSfzwig8QVsYmEUf9TwnOz22xLNhuI/UcygZ8UH4f2y6cDR0JposAJUfu3pJ52 yZv891Tq7P7iKEhmmZHB73nV6OM2IFQ40xZ9/1JIh7GMG7/VgVbSUyPzKu1vZsoNP2Wi zb2WT8aQReTABBJXSQw0XtUvyT/sDANzF7nVEI61qUuCvBy+CgdKNZ4BcXtuH9e+EIae QVPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ds4ZVlPOzvwTUXxm8CWmPR/78xRX0JHc5Iyf+QRVEvs=; b=PFbB0BzhH/rgmERfT93qjfKT0epXn684dBxYC/HBimoTlr7V1N1QYhMjVBruCg9olY LhhFfVlR4pdT6mriaBuvimMp99b0JD4fX0YC4kjG0El7yEccjhZ11b4n0XpPYOo1XZFw BN12C3Oy+iSRfo6ZX+UczUKqeod3f9KRSO6usvpdrF/2fMNHdDztEWmv/33vz/5dgJtm CM3viRKtype7KUtKhcTbkX9q1giEVlbhixFC1uO+KOg2ZLILf+83HZQ30sHGcNQrqxUN 2H84d2cvxCBvJTKVTHGhUwJm80L6dJ2VlSHy5u7x666yS/1acI3DVUdvjjf6KXingmH8 Vs6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q91GhkCG; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si6259326otj.165.2019.12.05.13.56.14; Thu, 05 Dec 2019 13:56:26 -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=@gmail.com header.s=20161025 header.b=Q91GhkCG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387567AbfLEVxN (ORCPT + 99 others); Thu, 5 Dec 2019 16:53:13 -0500 Received: from mail-il1-f193.google.com ([209.85.166.193]:36276 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730318AbfLEVwM (ORCPT ); Thu, 5 Dec 2019 16:52:12 -0500 Received: by mail-il1-f193.google.com with SMTP id b15so4423142iln.3 for ; Thu, 05 Dec 2019 13:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ds4ZVlPOzvwTUXxm8CWmPR/78xRX0JHc5Iyf+QRVEvs=; b=Q91GhkCGW+ye3okkqCQSAoPuzHPUn0SNToCW4VqLC0ycmbjVQSwghiWhFR6gT+Mirw JPnKvnogYwqTYmPxJm+xbgt61yj9SjuMr9qlY7/ytcKHChDHhxqomgxhuN29Sg5CSa8v TrAZ7hNExjtiURYWXE/a4+B44XmjVrprWT674G+2UZjcKTQBIwi+/8GLsnR3rNuRyUqH ayXzSnnXlMWuRrIGdnDdeNfaXcyYfIDcZQ8MLx7AI0Pd7y0PRDiABT6QoQt80v/7v79M YyHSjVnRAHMEpKMD0dtNfQut8DXymEscR40MhwqaZW9ODYiVWpvf/Kt3TFSp4QUh5flj uXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ds4ZVlPOzvwTUXxm8CWmPR/78xRX0JHc5Iyf+QRVEvs=; b=hmumB8ATfR/Hh/vVJwziqrXuisqMGT+TWYrsq18b92neVtODIhsSa3GINjwjrySUgq mWpEqTDHYEs0oTMsaH/hIsrvMJdxp6xNZFkJk8OIG335CVPoE+cEeycgSvq1Wn5Wkkrk ttZvKkL5V4LtbL7SLkb9eLpELcDg4gxwQz6rYjH1SRb+49ZDLtDH7NoXv8Fxo4TelnUg Ie+8iSqR9AzJWnwIW3pYcpMLO7xlgre/aQi/h2ssyyKk0BgRaClh1wOP50VVtQpuQrfE RzKSINZMsLwgu/pIqH9NCstfEktv80lZNaS0ioW4u4+Mce8gBICIaGMppF1F/BOVdbqy 834A== X-Gm-Message-State: APjAAAWUoHfHTVToZm6tZeKiR0hwqqNrOE5RpXsHEWHQyUzxKbhnHM2S 95mrEPw9NR6Czpxn07Mvz4Q= X-Received: by 2002:a92:660e:: with SMTP id a14mr11065037ilc.235.1575582731466; Thu, 05 Dec 2019 13:52:11 -0800 (PST) Received: from localhost.localdomain (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id n22sm740184iog.14.2019.12.05.13.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 13:52:10 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: linux@rasmusvillemoes.dk, Jim Cromie Subject: [PATCH 05/18] dyndbg: fix overcounting of ram used by dyndbg Date: Thu, 5 Dec 2019 14:51:36 -0700 Message-Id: <20191205215151.421926-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191205215151.421926-1-jim.cromie@gmail.com> References: <20191205215151.421926-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org during dyndbg init, verbose logging prints its ram overhead. It counted strlens of struct _ddebug's 4 string members, in all callsite entries, which would be approximately correct if each had been mallocd. But they are pointers into shared .rodata; for example, all 10 kobject callsites have identical filename, module values. Its best not to count that memory at all, since we cannot know they were linked in because of CONFIG_DYNAMIC_DEBUG=y, and we want to report a number that reflects what ram is saved by deconfiguring it. Also fix wording and size under-reporting of the __dyndbg section. Heres my overhead, on a virtme-run VM on a fedora-31 laptop: dynamic_debug:dynamic_debug_init: 260 modules, 2479 entries \ and 10400 bytes in ddebug tables, 138824 bytes in __dyndbg section Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0a4588fe342e..b5fb0aa0fbc3 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1008,7 +1008,6 @@ static int __init dynamic_debug_init(void) char *cmdline; int ret = 0; int n = 0, entries = 0, modct = 0; - int verbose_bytes = 0; if (__start___dyndbg == __stop___dyndbg) { pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n"); @@ -1019,9 +1018,6 @@ static int __init dynamic_debug_init(void) iter_start = iter; for (; iter < __stop___dyndbg; iter++) { entries++; - verbose_bytes += strlen(iter->modname) + strlen(iter->function) - + strlen(iter->filename) + strlen(iter->format); - if (strcmp(modname, iter->modname)) { modct++; ret = ddebug_add_module(iter_start, n, modname); @@ -1038,9 +1034,9 @@ static int __init dynamic_debug_init(void) goto out_err; ddebug_init_success = 1; - vpr_info("%d modules, %d entries and %d bytes in ddebug tables, %d bytes in (readonly) verbose section\n", + vpr_info("%d modules, %d entries and %d bytes in ddebug tables, %d bytes in __dyndbg section\n", modct, entries, (int)(modct * sizeof(struct ddebug_table)), - verbose_bytes + (int)(__stop___dyndbg - __start___dyndbg)); + (int)(entries * sizeof(struct _ddebug))); /* apply ddebug_query boot param, dont unload tables on err */ if (ddebug_setup_string[0] != '\0') { -- 2.23.0