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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C918CC433F5 for ; Sat, 30 Apr 2022 04:00:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 604876B0073; Sat, 30 Apr 2022 00:00:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58C9A6B0074; Sat, 30 Apr 2022 00:00:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42D5B6B0075; Sat, 30 Apr 2022 00:00:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 30D8A6B0073 for ; Sat, 30 Apr 2022 00:00:25 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 09D9A20FD5 for ; Sat, 30 Apr 2022 04:00:25 +0000 (UTC) X-FDA: 79412193210.06.CAEAAA4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id AA91C40010 for ; Sat, 30 Apr 2022 04:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651291223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sKB6FlYNwY4+wlgwk3rv/2ltFqVWdp3lmtPGlyyyGGo=; b=ETSEpC1Grbg5pv+cyJS2gGr2EuAsb+K4EJsx/8DzCLJCuwNqkThpERRqUH/5miiW/I0yDn WsA7Ikn8+A8aGqnzzldBqkbe3epsP4d0b06AlhKAmm4i2Y83vYC0pwwgVxX/byPwVZhJW1 P6CPSOc+fDUG6lcg0MJNqLwECbz60Io= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-5i76_nRwN42UJtv2XPjKew-1; Sat, 30 Apr 2022 00:00:21 -0400 X-MC-Unique: 5i76_nRwN42UJtv2XPjKew-1 Received: by mail-wr1-f72.google.com with SMTP id j21-20020adfa555000000b0020adb9ac14fso3706763wrb.13 for ; Fri, 29 Apr 2022 21:00:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sKB6FlYNwY4+wlgwk3rv/2ltFqVWdp3lmtPGlyyyGGo=; b=rdA7NuQD/72CIoPfI9drHKyr4ANiJ5Www4ApRqwhxt7V6Qo6WJ0kj0RZh9tm5MpOjV zYOJ3UCVadWd0BbsDx+LniYk1ESs3/BWU6h/wjynwZhD80Pfw9UUcXHQRPdiQVa0ekX8 QZjdKg2umFmav3hUgjWJxMHil6jrAe1S0cTwClp0u/2kiY87eMw+yGm9jU1A+SisF4zZ ZCQYJLczvnjN74GoA/amZ3r0znu8RtVWazvn3ADFeQpi3Ey8eTwnxljlK8u2V8fZcM97 WtPG821nEnW4jsdPnOY7QECh5WPD1z1MkHn8OsLXZP++EWO4rfykvLI+ryBp97fp2BDH Dh/w== X-Gm-Message-State: AOAM533l1gVskSEhmfYuBLHR76kGibTXFsna8CRmhOq2WMx7UI6xbF8l GzXZvhOWbZxPeuu+tV30aeWNJvUssioecpPQteI/NsGW1kx27HsuR4TPwybHu9J/frqo1xhQq/R /0/oj5S76sryTD76XD/JSzM7rr94= X-Received: by 2002:adf:ee81:0:b0:206:1b32:d6f2 with SMTP id b1-20020adfee81000000b002061b32d6f2mr1559776wro.144.1651291219821; Fri, 29 Apr 2022 21:00:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyLeeVtNgwwU9RGNYZQkn5+DYkg+QFnnf5jW3HF7IgxWHGisBGg3RhxLrXZWdxkQaYbA/ce/QbaCUurXmPnwo= X-Received: by 2002:adf:ee81:0:b0:206:1b32:d6f2 with SMTP id b1-20020adfee81000000b002061b32d6f2mr1559762wro.144.1651291219592; Fri, 29 Apr 2022 21:00:19 -0700 (PDT) MIME-Version: 1.0 References: <20220421234837.3629927-1-kent.overstreet@gmail.com> In-Reply-To: <20220421234837.3629927-1-kent.overstreet@gmail.com> From: Dave Young Date: Sat, 30 Apr 2022 12:00:08 +0800 Message-ID: Subject: Re: [PATCH 0/4] Printbufs & shrinker OOM reporting To: Kent Overstreet Cc: "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, roman.gushchin@linux.dev, hannes@cmpxchg.org, kexec@lists.infradead.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: 6hf8dbopnc9wgr743s1mpkotut4i7dhm X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: AA91C40010 X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ETSEpC1G; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf04.hostedemail.com: domain of ruyang@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=ruyang@redhat.com X-HE-Tag: 1651291218-956370 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: Hi Kent, On Fri, 22 Apr 2022 at 07:56, Kent Overstreet wrote: > > Debugging OOMs has been one of my sources of frustration, so this patch series > is an attempt to do something about it. > > The first patch in the series is something I've been slowly evolving in bcachefs > for years: simple heap allocated strings meant for appending to and building up > structured log/error messages. They make it easy and straightforward to write > pretty-printers for everything, which in turn makes good logging and error > messages something that just happens naturally. > > We want it here because that means the reporting I'm adding to shrinkers can be > used by both OOM reporting, and for the sysfs (or is it debugfs now) interface > that Roman is adding. > I added the kexec list in cc. It seems like a nice enhancement to oom reporting. I suspect kdump tooling need changes to retrieve the kmsg log from vmcore, could you confirm it? For example makedumpfile, crash, and kexec-tools (its vmcore-dmesg tool). > This patch series also: > - adds OOM reporting on shrinkers, reporting on top 10 shrinkers (in sorted > order!) > - changes slab reporting to be always-on, also reporting top 10 slabs in sorted > order > - starts centralizing OOM reporting in mm/show_mem.c > > The last patch in the series is only a demonstration of how to implement the > shrinker .to_text() method, since bcachefs isn't upstream yet. > > Kent Overstreet (4): > lib/printbuf: New data structure for heap-allocated strings > mm: Add a .to_text() method for shrinkers > mm: Centralize & improve oom reporting in show_mem.c > bcachefs: shrinker.to_text() methods > > fs/bcachefs/btree_cache.c | 18 ++- > fs/bcachefs/btree_key_cache.c | 18 ++- > include/linux/printbuf.h | 140 ++++++++++++++++++ > include/linux/shrinker.h | 5 + > lib/Makefile | 4 +- > lib/printbuf.c | 271 ++++++++++++++++++++++++++++++++++ > mm/Makefile | 2 +- > mm/oom_kill.c | 23 --- > {lib => mm}/show_mem.c | 14 ++ > mm/slab.h | 6 +- > mm/slab_common.c | 53 ++++++- > mm/vmscan.c | 75 ++++++++++ > 12 files changed, 587 insertions(+), 42 deletions(-) > create mode 100644 include/linux/printbuf.h > create mode 100644 lib/printbuf.c > rename {lib => mm}/show_mem.c (78%) > > -- > 2.35.2 > Thanks Dave