Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5816724ybc; Wed, 27 Nov 2019 09:52:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxFAa+BM4cMYgx9k0tDSFiNU+30Gs40DRthnfAOXeM0JZ2kUDJk6KO7gE1/FmyJ4BqlvYIb X-Received: by 2002:a50:b63b:: with SMTP id b56mr33559793ede.165.1574877161910; Wed, 27 Nov 2019 09:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574877161; cv=none; d=google.com; s=arc-20160816; b=KdBTwDCrwzBbcbk1tSKfjQdwjog+8sgIYgmDMWy+qI66A83WiWTg0/8JJ05P9Jp571 TPx7/yG3DhBH4VIOgplV6yfN5ljDQmYPwoTnFh+joNdR4INR/bv9tNQe44cNWEhNruMh z0EIN5YogS5ni6VsaZ1eT+bx7VU64fF6OOaGlqh4EqjD37PamLZg6GknPwl6/NGTBG1G ntV1J5YCzvw6m1KOTMjm98AjLCH2/7fVIXc/7r19sHfc3S56x9JwtKz0PB7IlxU7E1Cf K9R5EfUlEjl44IzCAQkgpTvs8LIHZ6quDlpLxOvetdc8H1sRK3fvz7Yd1Tcdgdip4L7Y Yz/Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=/stFClXYrFISZefBb+JDS4GEu+QGCmV4uRwHZjJAkoE=; b=ZjHpJxLiKM/WgsmwT4K2D6FQWCnD+qizzQmmbmfyJnBrr2Y+Nv/QG+o5FWnsVGNBqo gUIBvYQDi7v9BljGQ1d333i/MDxpr0gPCrfBchFNBucCyk8o89xyZBn3KZ7vpHbpwp55 aRf4WeTWiuHHKmYGXotNQPjc++A8CDnz/hnr14dvYFKgeFOO5k2tzlKIWelrbnIrxfHB IPk2ErxhYLIchVReyveZ6mYVLDUhgSrRQLAlP7oiicDpdlqUJZB1xgjWjVruWT8qvA/n 8Qejvj1fpP6rBJKScFl/BhMhCBbU7zkQLxpFC1UU6ZINCvPb27L+ux27UJwNsgHIEGbl kV9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WtbQzuZI; 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 v2si13133793ede.61.2019.11.27.09.52.18; Wed, 27 Nov 2019 09:52:41 -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=WtbQzuZI; 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 S1727244AbfK0RvB (ORCPT + 99 others); Wed, 27 Nov 2019 12:51:01 -0500 Received: from mail-il1-f194.google.com ([209.85.166.194]:45442 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbfK0RvA (ORCPT ); Wed, 27 Nov 2019 12:51:00 -0500 Received: by mail-il1-f194.google.com with SMTP id o18so21740008ils.12 for ; Wed, 27 Nov 2019 09:50:58 -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:mime-version :content-transfer-encoding; bh=/stFClXYrFISZefBb+JDS4GEu+QGCmV4uRwHZjJAkoE=; b=WtbQzuZI5b1TaYrehfBirydN35Ren4ZIo00zSBYkzZEL8CHiSswnIK373C2LaXRosk PdOzdvuvK+LKqtlG7bLOWn1/sm7t6c64Pa8ya9DOcx/uzYudr5+dZoEkuLYxxP8+VZE6 313BBdHqbNzAo2N1VXBsIcwTEui0zH+7r8qoU/u7LvJsx11nPDMov4O2asLsOGofNmON am2+YO+QQCuX5pyR7cWtQ4+w4vJZ2RgOAxLELzPZZugSqeU7OTgQOrLZ9Yxu0VCcm2z8 6kJAlebfwnARnQ376P3aVx+/IqKhr9sPKq97qEHZLKgNnJYvdJj73/VP5/+kdP3lzyZL l/ag== 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:mime-version :content-transfer-encoding; bh=/stFClXYrFISZefBb+JDS4GEu+QGCmV4uRwHZjJAkoE=; b=TkFSz5grt8m0UpRFQvD8B+5qVPWkIBuSZxX3iHQdMdu0QqqRmHjQ6HFLV2DLCr33db b05z3+PaS2kojGQoKiEBpqdrp34j+93LroVbp1vXRkFAodbAaakCArfJG5g8qxIhI89C cooRRjbnlbgrvtGZthmk3EklP0nflrli7O/74VTzYzeJtHPsleO4XRSt4WsURlCNR350 KNQKQ1ST5xowEDHTZcY8h4OPpX4XUxWE78gu2y9+NbX85ym/AvSvxDc9ibCy4WJVcFhc qbNwSw5bMIbrrXHs4foUCKaKUT8e9TTrW4g1r6YEEWV3GTmcdppb/wv6BUbOHXz+JzcO hhVQ== X-Gm-Message-State: APjAAAW81aW8xphepx5v4OAu9942E04JvMgIpGbCE+L5drY5b4Df2dxd NCZohgtboY/OqS3olv0eu3k= X-Received: by 2002:a92:d7cf:: with SMTP id g15mr46202361ilq.171.1574877058325; Wed, 27 Nov 2019 09:50:58 -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 v123sm3855442ioe.35.2019.11.27.09.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 09:50:57 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org Cc: linux@rasmusvillemoes.dk, greg@kroah.com, Jim Cromie Subject: [PATCH 05/16] dyndbg: fix overcounting of ram used by dyndbg Date: Wed, 27 Nov 2019 10:50:55 -0700 Message-Id: <20191127175055.1351403-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.23.0 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. 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