All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt@readmodwrite.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Oscar Salvador <osalvador@suse.de>,
	Vlastimil Babka <vbabka@kernel.org>,
	Caleb Kan <ckan@cloudflare.com>,
	Caleb Kan <calebkan1106@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kasan-dev@googlegroups.com, kernel-team@cloudflare.com,
	Matt Fleming <mfleming@cloudflare.com>
Subject: [PATCH v3 06/10] mm/page_owner: Read stack traces with stack_depot_fetch_into()
Date: Fri, 13 Nov 2026 18:56:58 +0000	[thread overview]
Message-ID: <20261113185702.1332171-7-matt@readmodwrite.com> (raw)
In-Reply-To: <20261113185702.1332171-1-matt@readmodwrite.com>

From: Matt Fleming <mfleming@cloudflare.com>

stack_print() reads stack_record->entries directly. A later patch
stores compressed frames inside struct stack_record, so rather than
decompressing those frames let's use stack_depot_fetch_into().

Copy the trace with stack_depot_fetch_into() into a stack-local buffer
with PAGE_OWNER_STACK_DEPTH elements, which is the maximum number of
frames page_owner saves.

Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
---
 mm/page_owner.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index cfc31c92d765..16429e70e00d 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -1068,8 +1068,8 @@ static int stack_print(struct seq_file *m, void *v)
 {
 	int i, nr_base_pages;
 	struct stack *stack = v;
-	unsigned long *entries;
-	unsigned long nr_entries;
+	unsigned long entries[PAGE_OWNER_STACK_DEPTH];
+	unsigned int nr_entries;
 	struct stack_record *stack_record = stack->stack_record;
 	struct stack_print_ctx *ctx = m->private;
 
@@ -1083,8 +1083,8 @@ static int stack_print(struct seq_file *m, void *v)
 		return 0;
 
 	if (ctx->flags & STACK_PRINT_FLAG_STACK) {
-		nr_entries = stack_record->size;
-		entries = stack_record->entries;
+		nr_entries = stack_depot_fetch_into(stack_record->handle.handle,
+						    entries, ARRAY_SIZE(entries));
 		for (i = 0; i < nr_entries; i++)
 			seq_printf(m, " %pS\n", (void *)entries[i]);
 	}
-- 
2.43.0


  parent reply	other threads:[~2026-11-13 18:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 18:56 [PATCH v3 00/10] stackdepot: store compressed frames in stack records Matt Fleming
2026-11-13 18:56 ` [PATCH v3 01/10] stackdepot: add caller-owned stack trace fetching Matt Fleming
2026-11-13 18:56 ` [PATCH v3 02/10] mm/kmemleak: use stack_depot_fetch_into() for leak reports Matt Fleming
2026-11-13 18:56 ` [PATCH v3 03/10] kmsan: use stack_depot_fetch_into() for origin reports Matt Fleming
2026-11-13 18:56 ` [PATCH v3 04/10] mm/slub: use stack_depot_fetch_into() for owner tracking Matt Fleming
2026-11-13 18:56 ` [PATCH v3 05/10] drm/locking: print deadlock backtraces with stack_depot_snprint() Matt Fleming
2026-11-13 18:56 ` Matt Fleming [this message]
2026-11-13 18:56 ` [PATCH v3 07/10] stackdepot: Remove stack_depot_fetch() Matt Fleming
2026-11-13 18:57 ` [PATCH v3 08/10] stackdepot: add architecture hooks for compact frame storage Matt Fleming
2026-11-13 18:57 ` [PATCH v3 09/10] stackdepot: Store compressed frames in stack records Matt Fleming
2026-11-13 18:57 ` [PATCH v3 10/10] scripts/gdb: Decode compressed stack depot frames Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113185702.1332171-7-matt@readmodwrite.com \
    --to=matt@readmodwrite.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=calebkan1106@gmail.com \
    --cc=ckan@cloudflare.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mfleming@cloudflare.com \
    --cc=osalvador@suse.de \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.