From patchwork Wed Nov 22 23:25:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 13465557 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 9313FC27C40 for ; Wed, 22 Nov 2023 23:25:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A7686B05EA; Wed, 22 Nov 2023 18:25:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1580D6B05EB; Wed, 22 Nov 2023 18:25:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01ED76B05EC; Wed, 22 Nov 2023 18:25:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E37636B05EA for ; Wed, 22 Nov 2023 18:25:27 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B52D2120B3B for ; Wed, 22 Nov 2023 23:25:27 +0000 (UTC) X-FDA: 81487173894.01.F988E47 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) by imf26.hostedemail.com (Postfix) with ESMTP id EDBC314001C for ; Wed, 22 Nov 2023 23:25:25 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=a+xYFgN1; spf=pass (imf26.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.177 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700695526; 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:references:dkim-signature; bh=dIP68Sfayd7Btc+B0Ey1P6bn1vCBpsnFEN+7f1RnHmY=; b=mBC1na1o/2sX6VOJcYw862WlxTqfuVDuott53o23ThM8qYTBHkjUDOk/rT6JYN/4yRPF2+ Yh8IoGBQzBdPXpeNBiqFZ2Z+EEyxPhjYAoAeLPB9TeKBkNzoCtqpQrh3H7/ctV6+I6lWeO dxDqI5dzSUG2j6T19oPlpcbdg64VBHU= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=a+xYFgN1; spf=pass (imf26.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.177 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700695526; a=rsa-sha256; cv=none; b=dpUwbpL2bi+2jkE/+ACDBwIvGVhfnSt8TcgbfFBXWBOPeXd4oBico4/mQ6MgqVWt0h6LQh yroQZNXwSsfaHkgwPlr0TX2dfrMevHORVwg2G5gFxQT5D7bZkScnFfNlQgb8/MIRDyEyjI wD75/N54aeLF2lTQ9q5RrqAsm3Zz8CY= 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=1700695524; 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; bh=dIP68Sfayd7Btc+B0Ey1P6bn1vCBpsnFEN+7f1RnHmY=; b=a+xYFgN1q5vbNFYogOWrJxLSQUs5HjfgpzE8YsBiaqKzWEpu679gb012GNy5KvmGxwMPh2 nDedlShTYQe6N2NuhmsVtN6HcMmZDU3EMYJrrbZTL3SXPOb6w3m/iG0T9k3jLDSI5ZHna9 Fm2PzoldoaOMxM8HbrfLwqsX9mb4lkQ= From: Kent Overstreet To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet Subject: [PATCH 0/7] shrinker debugging improvements Date: Wed, 22 Nov 2023 18:25:05 -0500 Message-ID: <20231122232515.177833-1-kent.overstreet@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: EDBC314001C X-Rspam-User: X-Stat-Signature: ypn3affeftm4s8qu4zoigok7xd9hcr58 X-Rspamd-Server: rspam01 X-HE-Tag: 1700695525-691628 X-HE-Meta: U2FsdGVkX1/L27Zbz0b5zQaLhJUWupZsPYCULllZTaxaeffCKDrjq/eS8D7E4na0bS9fPf2XX31oKwuP9/ZnPFCe8Lq4j73gpOldFDgppXuNoUMr1QggZwBYNTrELlXOT0ictKlwN5GR4pWV8wxb1o+YA+sN4xXJ/1bG93+YwSmLvlVXTM/5T6GOdkTl76CPTvqN+awJel/QZlno/0Aj/EspypfetZ2FDyE5XmK9UsA9MguEYStbvfvFKbbk+iwrxDgxliKdLH5hWwl7EB6qmJUPusUCxb9iUvXcz96eOFB8ToLzKvjflhLZqE9YEJJrKOZx18WTxB/M3QRIwYVwizJHBY0pbieI/Gama6OHw2rZ2Y5cjbldyNXt2YUmursLZn0GMTlklq3k2cYUuwaovQ6LY/UJ2mIpsxGnqACWtX9SG8xDB50Gcpt5xyBWdnRv4HSXrvpbEXKnpw/dxgavUNNvAX1ZXz3GYLH52LqxLFFXlZZHREK89P2qfXzIJN1UF3qhctItkPt9wXsSRLfK1vbpKEZ1IdqV30b9dNwB7ZSAqUrFHwYBeqJwuLxiZUJ4v9dcg7phZxRnHCQyrl1CYQCWUv4XytZcpzvnj5wXRyI/ODTqkkR37dtUOoQgoPMBpDuRCCY8znxDTqX6sBkIB4z8z4rNv9DKTib9sp4pcnldyKZbcibO4G/Ofe6BE8ndQft6T5BBVVV801oezoLNbhxsN4Dq4WnqpFTNDZrWPhWfQN/omFVS01CTVep/HtsB+XO8kv8ye0n+0pQSm331jnHLjnwxKuQE0DbFTP4ZEsQeCOw2elnTRArY5JAApXtsjfr/au9vRiH8cmD6l8T8SoE0rSq0frP/w02dlzNX2nT3Dbu+FbMs7RQFc2CnLATH5DaTrO6LvB3PS1SomeBn5SPihCdVk5DMD0+k5A+uV4nCSCPHSslLDrXasNIV2mTFHXAXhXmD+3PyhWQnsIl hJ51yuoQ YwIzSm7SqB4dqDS9eqMiZarD1IeKux7nXdLkYh4P9+ZjHmJaUnr6aWniIbmzYGiCqPseTAV1EYtjKSC8= 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: This patchset does a few things to aid in OOM debugging, in particular when shrinkers are involved: - improves the show_mem OOM report: it now reports on shrinkers, and for both shrinkers and slab we only report the top 10 entries, sorted, not the full list - add shrinker_to_text(), for the show_mem report and debugfs, and a an optional shrinker.to_text() callback to report extra driver-specific information - add extra counters for the shrinker_to_text() report - implement shrinker.to_text() for bcachefs, giving an example of how to use the callbacks Daniel Hill (1): bcachefs: add counters for failed shrinker reclaim Kent Overstreet (6): seq_buf: seq_buf_human_readable_u64() mm: shrinker: Add a .to_text() method for shrinkers mm: shrinker: Add new stats for .to_text() mm: Centralize & improve oom reporting in show_mem.c mm: shrinker: Add shrinker_to_text() to debugfs interface bcachefs: shrinker.to_text() methods fs/bcachefs/btree_cache.c | 102 +++++++++++++++++++++++++++------- fs/bcachefs/btree_cache.h | 2 +- fs/bcachefs/btree_key_cache.c | 14 +++++ fs/bcachefs/btree_types.h | 10 ++++ fs/bcachefs/sysfs.c | 2 +- include/linux/seq_buf.h | 4 ++ include/linux/shrinker.h | 12 +++- lib/seq_buf.c | 10 ++++ mm/oom_kill.c | 23 -------- mm/show_mem.c | 20 +++++++ mm/shrinker.c | 89 ++++++++++++++++++++++++++++- mm/shrinker_debug.c | 18 ++++++ mm/slab.h | 6 +- mm/slab_common.c | 52 ++++++++++++++--- 14 files changed, 305 insertions(+), 59 deletions(-)