From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DIET_1, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 244C9C56201 for ; Wed, 25 Nov 2020 19:37:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7B5FB2063A for ; Wed, 25 Nov 2020 19:37:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ICocZEqa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B5FB2063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B0C8F6B005D; Wed, 25 Nov 2020 14:37:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A96746B0070; Wed, 25 Nov 2020 14:37:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9371B6B0071; Wed, 25 Nov 2020 14:37:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 77E8A6B005D for ; Wed, 25 Nov 2020 14:37:09 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 401B21EF1 for ; Wed, 25 Nov 2020 19:37:09 +0000 (UTC) X-FDA: 77523948978.23.year74_620030527379 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 21CEF37606 for ; Wed, 25 Nov 2020 19:37:09 +0000 (UTC) X-HE-Tag: year74_620030527379 X-Filterd-Recvd-Size: 6373 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 19:37:08 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id t13so3203767ilp.2 for ; Wed, 25 Nov 2020 11:37:08 -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=5JkQcQp14En4LFF6E6DLPJVf1CuRwzYOmsbNNlK0uxQ=; b=ICocZEqaemFmnNdW8e5TMHd3f7t3z1FwIAlXwXOB5JPPUUurIEpAeW1o9weSIvaB0i a/GNtgcCBrPwxQk+MTUx3bYtqDDLR54wWOjjE2jHCnwD2yvq3ZpjposLHJVuNZ72Og+3 yOLZN7I7Ng6Ndl32y0+bxhB1bY7D7M0MHA4lIYRsFsZrKqIRcYxZE7iKIXck1Byd7pmX upd3RwaMUI/l0809GyCFCJrMNpO+mvOlvMVsUd8W/5DuR4mwNhyVKASLfp2e78ER400s kzaZ4qhxVNSZf9ZzlqkEZAVdjKnRPYKlav7GriCmL+eTFcnYHGFEKkoWYexVxhZqzliW vDdQ== 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=5JkQcQp14En4LFF6E6DLPJVf1CuRwzYOmsbNNlK0uxQ=; b=eBSazXW0mBwsr2dgSZgapIL0RRqmj+GuIRmGlhBtmyiEcGXbCsBAzcMCpqX7gPg160 Ji2OoibWl6L+njSuENz8k8BYhYKvsboUHtmWXNI4zAl0hu/lg5T774diYlY3EVqKWDsm 1g2o14u4Q50rmSDN2Ln5+d5PDFaBpomVNYxCQ/E12BDHI+Holql4BCLiYbq25MNLLBzN Yjin7T4sFh+PGgCa3f0ptdJ1cLzoB1OOkWHK6Fmh10gCZ3651oDSsEyOPDAzMbM7GIgE cmFlVmlM6t23YoOKWrMZFNnDonMLtYTaYq5VBbXUv+LMe5stx3P6P/NoBaEtZzargbQ4 BJ3A== X-Gm-Message-State: AOAM531lY6itJCIACa3bCkuY3M6KjtRcRwyRDguGYBhwR2bwGWsW98xo tkaaTTFGtirGx+2YXzAgY467kRkzjUc= X-Google-Smtp-Source: ABdhPJwtu/cxwRpeMFnvaS+KIMkzRewZIKqSgRuW138rcLhbvWtIsrUSM2VKphzJZr/JqY+o3UW2tQ== X-Received: by 2002:a05:6e02:dc2:: with SMTP id l2mr4451608ilj.2.1606333027650; Wed, 25 Nov 2020 11:37:07 -0800 (PST) Received: from frodo.mearth (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id f8sm1435548ioc.24.2020.11.25.11.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:37:06 -0800 (PST) From: Jim Cromie To: linux-mm@kvack.org Cc: gregkh@linuxfoundation.org, linux@rasmusvillemoes.dk, Jim Cromie Subject: [PATCH 0/7] WIP dyndbg diet plan, paging Dr Zram. Date: Wed, 25 Nov 2020 12:36:19 -0700 Message-Id: <20201125193626.2266995-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: hi all, To celebrate a season of ritual overeating, Id like to propose a diet plan for dynamic_debug. dynamic-debug is carrying extra weight/memory in the __dyndbg linker section, which is basically a struct _ddebug array[]. The 5 display oriented fields carry hierarchical data, and since the linker section is ordered, there is lots of repetition in .module .file .function fields. This patch-set: 1) splits struct _ddebug in 2, creating creating _ddebug_callsites with 5 display-fields, which are placed in a new linker section. while this adds indirection, it lets us manage storage of the .site data, letting us keep the bulk of it in compressed form. 2,3) explores run-length-encoding as one alternative to zram, basically throwaway, but for any ensuing discussion. 4) do kconfig bits - needs work 5) at late-init, copy site recs into zram (and save to .zhandle), thereafter .site is "refilled" (when null) from the .zhandle. Updating the _ddebug.site pointers also means we forget the link-time refs to _callsites section, allowing its reclaim later (once I know how). The .site "refill" is by _getsite(); the corresponding _putsite() works: it zs_unmaps ASAP and zeros .site. This means that every pr_debug will map/unmap once, and `cat control` will do so per line. Probably too expensive. But it works. Im seeing 3 pages_per_zspage, on entire section. 6) a hot locking mess. well, maybe not. plenty of uncertainty though. 7) does not work. It changes _putsite() to keep each zs_mapping when the pr_debug is enabled. But it panics in late-init, with BUG sleeping in atomic context. ? dynamic_emit_prefix is in backtrace. disabling all pr_debugs (--kopt \*.dyndbg=3D-p) gets to root prompt. once there: echo module main +m > /proc/dynamic_debug/control # is ok echo module main +p > /proc/dynamic_debug/control # BUG sleeping invali= d context This strongly implicates the dynamic_emit_prefix call chain. It puzzles me that keeping the zs_mapping would cause so much trouble; its not causing more pr_debugs, and they should all be mapped already. But I really dont know what Im doing here.. WAG at possible memory savings: - add 2 pointers (zhandle, site) 56+16 - drop 48 (sizeof _callsite) * num-pr-debugs linker section - replace with 3:1 storage on same - 48 bytes per enabled pr_debug, typically <1% of set IE: dyndbg: 216 modules, 2058 entries and 8640 bytes in ddebug tables, 11524= 8 bytes in __dyndbg section VS: dyndbg: 224 modules, 2015 entries and 8960 bytes in ddebug tables, 80600= bytes in __dyndbg section, 80600 bytes in __dyndbg_callsites section dyndbg: 2015 entries. repeated entries: 1790 module 1668 file 810 func Once __dyndbg_callsites section is reclaimed, %30 savings looks likely. Jim Cromie (7): dyndbg: move struct _ddebug's display fields to new _ddebug_callsite dyndbg: count repetition in __dyndbg_callsite fields. dyndbg: add some code to see alignments of linkage data dyndbg: select ZPOOL,ZS_MALLOC in Kconfig.debug DYNAMIC_DEBUG_CORE dyndbg: replace __dyndbg_callsite section with a zs-pool copy. dyndbg: add locking around zpool-add loop in zpool-init dyndbg: enable 'cache' of active pr_debug callsites include/asm-generic/vmlinux.lds.h | 4 + include/linux/dynamic_debug.h | 42 ++++-- lib/Kconfig.debug | 2 + lib/dynamic_debug.c | 242 +++++++++++++++++++++++++----- 4 files changed, 239 insertions(+), 51 deletions(-) To: linux-mm@kvack.org Cc: Rasmus Villemoes --=20 2.28.0