Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp259111rdd; Wed, 22 Nov 2023 15:25:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IErGpEIiwOhYmgj54dl9m/iniEylpNLrjuFgEiDvpc/wiVtFxlH2t2Ehk51iv0H4Ibxz71z X-Received: by 2002:a9d:6d05:0:b0:6af:95f9:7adc with SMTP id o5-20020a9d6d05000000b006af95f97adcmr4358956otp.14.1700695533086; Wed, 22 Nov 2023 15:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700695533; cv=none; d=google.com; s=arc-20160816; b=NALlWTqpl7r70bawhm1fgLUeEQrpsfbhhxN7hP3mCvf0HDjM5w3S+23pXK7Ldc5TLM YCbahHoktiT3+FJiNkaF2YyZ4se40mdKeMhYhzb5Vsl8kpOEldFfJXTBE7Ho/Mk6ZBAU wegYpULd3MXmFwYLrYe6UkWyFQsowWAZBs5ty92+1P8nsoyS1FtUcbgTkgYRS1SPsxis siVBesrG35Ps3JtvsaiKD+l4ePprxU9MzI8CQjOX9Ev6afol1Ou7fktjfw/Vr5CwmPJa 0Vnviq4QN4NaoTxf5ZG3DTi3DAILLaydoMXS3syhwNoSrXNtK1F/uIQmAKCqVF565zjr Urww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=dIP68Sfayd7Btc+B0Ey1P6bn1vCBpsnFEN+7f1RnHmY=; fh=E4i1WlDjTcv4PaggG9LiH5M0StK1kb2o4G2+VCXOoG0=; b=r9cx1EKJqZxGuTHb1avEMAgf+El+iCRvjBgl+VnzoFdCdgc2TfV7h7jJWtzisZlANf EkT9V5JHHcuiU18CMatVsec7wNLHPUl7eOiDL766kV0kLmbTmiStvyYnFJuQpndMZ61W jDqV2j++v6GlWLNqTvZgafXTpgt976ut5AS/KK8j17x81JnubNfTFWBs6yXQmehhcMdF sVK3hWn6Eeiy2Zj0jYqLX7JyceTvm55Bu0mqb6S4/qJYlRhElJJOXbVrz+h7ML8m4yPY nA4Eerpc25on2JvaEQsenDQWMRwec1tvTDNCeJpK9scj/BFODyy83LLF7g4Eu3+wEbEp DZIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=a+xYFgN1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f12-20020a631f0c000000b005b21d089aabsi100975pgf.519.2023.11.22.15.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 15:25:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=a+xYFgN1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BB7F181D80A6; Wed, 22 Nov 2023 15:25:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229576AbjKVXZb (ORCPT + 99 others); Wed, 22 Nov 2023 18:25:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjKVXZa (ORCPT ); Wed, 22 Nov 2023 18:25:30 -0500 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [IPv6:2001:41d0:1004:224b::b2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70AC199 for ; Wed, 22 Nov 2023 15:25:25 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 15:25:31 -0800 (PST) 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(-) -- 2.42.0