Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1325669ybh; Sun, 19 Jul 2020 16:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY3h3rfb1BAuAON7VnViDwlH+muLyH1VQyvotddAXVTccYsfDiC35VujD8BryLdR8riWMW X-Received: by 2002:a17:906:4447:: with SMTP id i7mr17630075ejp.191.1595200340300; Sun, 19 Jul 2020 16:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595200340; cv=none; d=google.com; s=arc-20160816; b=xWE6eakyqq39OIx0hy19csA1n3tOGPc0FBxJ6RDdjcjq5Jje+EJIYWkSdd5K8X4Zci w5po73ERO33DyXRlDAYG6kYDd6dzcBuM10dx/TWVjY+TqBwseIgsRroKpzecVDWsjeQF X7SljlkW2AaFx8+bok1Ey06ni58PSNaFcfbTtsbozvx2qeccHSIFFA95wQgexPsU98h+ QcGABh4nlqa7kWnHpwsyLNljnVbzb+hsyavBugbPNaqJlDO5EU16cIb0TRmz8XIpYt0U UaAqQRJGYUx9uxjsAi8G5MvBmqBWMPv1cdmalDd0r5iiVnfyQ40WmarFMRr74yIL74Oq jPLA== 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=YvqTkcYAAN78pjSZwwNFeimQiSa/Q3KK8WoooVV/y3U=; b=F3LdNVYptOQMfe8B6oMlvDR9x6MNP5KBElG1ojIJaTQYakeCbG7ebG5fCzeMzomQtt iZy30yQNUtXi8VtkGHWib0EPD7V6qfRiOVJz/uEcZ1waqN2mnUfFd/P9Lb0KTemaOi3H Ff4LRYYFZk0WLVkG1nEaxudGfev+CjaducMjVGbSeAA3FlHfPVFmOP+c93J3vyEYX2fR CukL4xaiWFRktEx/tD/rBGd0PkyUfmvpY7WN/ZpIfZhCxZ0si5TQHTIi9QMT/hSX+TuZ ngGpdGeQTkFoGR5O/5rjR6Q1Ny483UpKvQcvQOxpb2Nx+/E3q04Txi5sxPMBanuf6ZWq +FYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e6WhusBd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d13si8993833edz.257.2020.07.19.16.11.57; Sun, 19 Jul 2020 16:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e6WhusBd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726994AbgGSXLh (ORCPT + 99 others); Sun, 19 Jul 2020 19:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbgGSXLa (ORCPT ); Sun, 19 Jul 2020 19:11:30 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530C7C0619D2 for ; Sun, 19 Jul 2020 16:11:30 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id 72so10827718otc.3 for ; Sun, 19 Jul 2020 16:11:30 -0700 (PDT) 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=YvqTkcYAAN78pjSZwwNFeimQiSa/Q3KK8WoooVV/y3U=; b=e6WhusBd6Ch7Qtj9IV1lz8mlCRxqljXa/TVPblWqQFh8lgjWLE9zydrspX+XboBc7y emIdWp4XcFaYNYwdJNZ7JAlYehwsgKojI24R43pUfWZDAWvMXCMU8UEMXjsbfUQ7RrmH tu+2rPPgQDZ0Y5DWKQFIfJTCM+XjaOyjTwIRLMPAZSMDaXQ/JFremy2OTog8lAg208Ph WQL1kdwA/pDglzVupPS293VRZceZ8Z6IVLSfViKb+XTOlslV+cTCYrgWbH7018djenTe D4mIMjFOJSC5m1ESRDYWdaanM7h7hD9s/RJS8tACqpKBfVKJRotoEkt52zVZjEeYvEiz 3meg== 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=YvqTkcYAAN78pjSZwwNFeimQiSa/Q3KK8WoooVV/y3U=; b=PsiykRJ8fcHNGJ0G7l4Sl2q5dvxJrZMUfsRrk5jScFj6cxBiCR3WFj9tCsHVpZcNhQ AR3m/jaOT+xksQ01I9Wdtlm89YmSCMgvTk7SKpN5ZCuQtszVZ6arPagQFdeM0gmkWDYg JBYs+UNbaYhEWV+w6P5/rbTYbImHq39obmqLXLVQqiu1OGbdHrneiPg5CeDk779fp5Ti bFF7sWN77b+I8e9Z/TuFGkT0rxCL5JzimZlK4jH3Utgr+Xj8qu7vqZFPrQ41lb4/pDlu b7JS/MDuq9LhtcBLnpumknUjRQzZz3FKq0dCi01/H5cfjaj9JsAuUI8slcvVDiECGuBX FeVw== X-Gm-Message-State: AOAM531JnIgNg4JIsJzMycJgb7RvJ+zYiCcyeekirk4iJ5jB9X8bSRY/ 3epm66Gan1W1JLhDyVswnMk= X-Received: by 2002:a9d:7f06:: with SMTP id j6mr17250728otq.51.1595200289745; Sun, 19 Jul 2020 16:11:29 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:6ba0::5e16]) by smtp.googlemail.com with ESMTPSA id q19sm2394680ooi.14.2020.07.19.16.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2020 16:11:29 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jim Cromie Subject: [PATCH v5 06/18] dyndbg: fix overcounting of ram used by dyndbg Date: Sun, 19 Jul 2020 17:10:46 -0600 Message-Id: <20200719231058.1586423-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200719231058.1586423-1-jim.cromie@gmail.com> References: <20200719231058.1586423-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 66c0bdf06ce7..9b2445507988 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1017,7 +1017,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) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { @@ -1033,9 +1032,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); @@ -1052,9 +1048,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.26.2