From patchwork Sat Aug 24 19:10:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 13776496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99994C5320E for ; Sat, 24 Aug 2024 19:10:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A57556B04B4; Sat, 24 Aug 2024 15:10:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E0DB800EE; Sat, 24 Aug 2024 15:10:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859FD6B04B6; Sat, 24 Aug 2024 15:10:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 565216B04B4 for ; Sat, 24 Aug 2024 15:10:36 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0796B140880 for ; Sat, 24 Aug 2024 19:10:36 +0000 (UTC) X-FDA: 82488080472.21.93170DD Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) by imf13.hostedemail.com (Postfix) with ESMTP id 56FD620008 for ; Sat, 24 Aug 2024 19:10:34 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ck5gsv4Z; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724526541; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gLXUgRI7sBHgtq1Zgi7tzIKwC1ZgZVmc7Lbaw9gZGks=; b=wyOYqgBoigXXgLALLnNuVOgJNfEtGXesDAz/hXMfE8ZPSHahXinCr09/8SZvVIfIdMz9ht ycPxTWRZaUc/BOIF0VVEWzeQ+C16n9GNT7EKHMuFTIwy5eoA98xW89UnNYNKWLFgWisaRf cQfPQgyEXZLyBvjnO73XKJf5dml2yyY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724526541; a=rsa-sha256; cv=none; b=WqGEgzHNVU0fu3UL4JpiLPJIenaYsuevyWC64WCb2hvtR5MQkx3ouIeYwRG4l6SmScw9jn PpVVpCwuNuI/6MhupIf1Y4pPWCm2M1zRJuNsEvzQBeTCBjfotUe2M85ob4pjCk9bMGhiOf asfDxbR+eGRpkc9yOL6WO8DYUA4Y140= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ck5gsv4Z; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1724526633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLXUgRI7sBHgtq1Zgi7tzIKwC1ZgZVmc7Lbaw9gZGks=; b=ck5gsv4ZoR5pxp5TUsQpbSPzWrRJTwaGYooqyAjp11QDTN/pIWspc3dTbamzmDUGeVggGC N8BJRfwiDcdd/iy84JeDNLEE6NPtBa6oUXUF2t0a2oFHHwv1CYfnVjHIVlap2dt81b5b4i CHzI+EMCI75H2EO/9enT5UD+XbFqqZE= From: Kent Overstreet To: david@fromorbit.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: Kent Overstreet Subject: [PATCH 05/10] mm: shrinker: Add shrinker_to_text() to debugfs interface Date: Sat, 24 Aug 2024 15:10:12 -0400 Message-ID: <20240824191020.3170516-6-kent.overstreet@linux.dev> In-Reply-To: <20240824191020.3170516-1-kent.overstreet@linux.dev> References: <20240824191020.3170516-1-kent.overstreet@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 56FD620008 X-Stat-Signature: ppoeihk3xnr7c7h9c91ny3wfqeuyrznj X-Rspam-User: X-HE-Tag: 1724526634-150681 X-HE-Meta: U2FsdGVkX19hRZJ1dqlIxI+rbaagTxuOi+4On0WAm8moZbVqS2aQN6+LV7re5zYwR0af1bMj7X+gYkp0UH50NBa9f15xpwFoS19i0QDL6oLmFRmt66mk6qa4Mbjzbq/d3bM2NUn8rAm5pfWZOzQ3SXdZ2yoOSeEfgX8P3GRFQjL6cevjoV7t5hJhbrFr4e50KO5rKjuAhIwV1MYhKLb0luFDGr1uV50Ph0KcDDMHJ19V/9oqKzQracVzs5jCREMAR3ucpVYhBjRaM/A+cu7T3Xp6qjkH2LC/V4q9WT+FWnIfIJnG1jPEc/8ZIClUyqpYWznJlFYuGlwExt8PPkm5pRjWry/M9pMOXXpS1i8qKXyB3+J7luyNCFv9vQfQAskHWJzzDyoyJCwlf0aATGfWoFSPPmFNF+ZWZFoyCSyNG3FpjqOMI5w9MLJk25ssvqqVdwIOECrbnMTSNuhpPKQj6NxBNPegDcfbeuLoueZdU/Z1l+PpHRLxOTD9bYRD5JEqb80NYxZEBiWmLVdTBz8VEWkwgMQz/KIO8VYz2Pev5XzuowLZSdmw/oySsZ0RFIZkPodYUodgB1hQQiMXI1CF2Lalzk/6Yaai+1x9f13s7ZR7QIQ97NzIybm6cgno9OpU3s0W3sLgD+1ePfKpcpDGpZoIPLjLIlzdRC1IKfTrdxR7uAl5c4pNfqU2rBCWZFn8jwhWeWpP3k5CkrcmB4e9+VX29tnKVWzaaIByITTESYeT8WIbLc/0hTTkB7p80zmcqheJEp/Zvo6cB8AurBMja3QQyaAhGDBUf0ydZU9tGUmVQ/2v4yHbxuoHJfIgVsUYnFjyroQ+XAp7P63cu/R3JhkvQjXHI1N6oCys2tLEkHc5D9gW9tNb1DCRMYNOwEqlX7Psl53ny1Cz97SNnTIY9pblvHVhX8n4O9ZkzWrW43geELi9u83O9jwGcVgCrbJ6MTadtWxdCGnlMumfwOe +YR0zg0A Z7hMgwY7y/Wxocwhzwtb5Mk8ptLF71OOdAcARYi+0Mfnt1GZmyV71By8QSlJfLErHmGNI+gwD4jhwVXTY+P8PGP3LKVEIBVbKDtmTN2v7tmbYQ/c9cW7uwv1or34ia82nmzLNCZTYiVlQ+SnXvQPgBEPDF7z+mOn7Gw4N X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Previously, we added shrinker_to_text() and hooked it up to the OOM report - now, the same report is available via debugfs. Signed-off-by: Kent Overstreet --- mm/shrinker_debug.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c index 12ea5486a3e9..39342aa9f4ca 100644 --- a/mm/shrinker_debug.c +++ b/mm/shrinker_debug.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -159,6 +160,21 @@ static const struct file_operations shrinker_debugfs_scan_fops = { .write = shrinker_debugfs_scan_write, }; +static int shrinker_debugfs_report_show(struct seq_file *m, void *v) +{ + struct shrinker *shrinker = m->private; + char *bufp; + size_t buflen = seq_get_buf(m, &bufp); + struct seq_buf out; + + seq_buf_init(&out, bufp, buflen); + shrinker_to_text(&out, shrinker); + seq_commit(m, seq_buf_used(&out)); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(shrinker_debugfs_report); + int shrinker_debugfs_add(struct shrinker *shrinker) { struct dentry *entry; @@ -190,6 +206,8 @@ int shrinker_debugfs_add(struct shrinker *shrinker) &shrinker_debugfs_count_fops); debugfs_create_file("scan", 0220, entry, shrinker, &shrinker_debugfs_scan_fops); + debugfs_create_file("report", 0440, entry, shrinker, + &shrinker_debugfs_report_fops); return 0; }