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 X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0DE9C432BE for ; Wed, 1 Sep 2021 09:07:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7197660F11 for ; Wed, 1 Sep 2021 09:07:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7197660F11 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E3CD38D0001; Wed, 1 Sep 2021 05:07:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DECE46B0071; Wed, 1 Sep 2021 05:07:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB4178D0001; Wed, 1 Sep 2021 05:07:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id B857F6B006C for ; Wed, 1 Sep 2021 05:07:39 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 735E4181DA082 for ; Wed, 1 Sep 2021 09:07:39 +0000 (UTC) X-FDA: 78538426638.19.A1EF1F2 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf22.hostedemail.com (Postfix) with ESMTP id F374E1902 for ; Wed, 1 Sep 2021 09:07:38 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CE290202A3; Wed, 1 Sep 2021 09:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1630487257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3jeCbfsUFcHiHKv3bA+MeCKvFKq2zsYwKYFQ0RSEWc=; b=LteYd9tBQXEEtiYmRamrsRzXsxjk4Vsh/7J2d0zl2ORjaIunNKsSOFLceM2zfp6nnoJMZM dDl29fP4Yd80K7AKv+xhpXPu4qJsLqcOOXlSB7Pr85ltnE/IIsXMERRY0rqd+x3KSKgNH7 zPTFXBiLlFD/Q5UE1CZb2QSPIXoM36M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1630487257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3jeCbfsUFcHiHKv3bA+MeCKvFKq2zsYwKYFQ0RSEWc=; b=78P8IW8OTZR4dAREobDMk3MfpLxLVNXiC2Gru0i8OFNeN3OOThY07xHRG8tVXuHqxCj5F4 IDovntQgOskonJCw== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id ADD2713A41; Wed, 1 Sep 2021 09:07:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id EskUKdlCL2FoFQAAGKfGzw (envelope-from ); Wed, 01 Sep 2021 09:07:37 +0000 Message-ID: Date: Wed, 1 Sep 2021 11:07:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Content-Language: en-US To: Imran Khan , geert@linux-m68k.org, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, "linux-mm@kvack.org" , Alexander Potapenko References: <20210901051914.971603-1-imran.f.khan@oracle.com> <20210901051914.971603-3-imran.f.khan@oracle.com> From: Vlastimil Babka Subject: Re: [RFC PATCH 2/2] lib, stackdepot: Add helper to print stack entries. In-Reply-To: <20210901051914.971603-3-imran.f.khan@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=LteYd9tB; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=78P8IW8O; spf=pass (imf22.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Stat-Signature: k9jmbaeq596t4h6r7peur65mhojbw5if X-Rspamd-Queue-Id: F374E1902 X-Rspamd-Server: rspam04 X-HE-Tag: 1630487258-674994 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: On 9/1/21 07:19, Imran Khan wrote: > To print a stack entries, users of stackdepot, first > use stack_depot_fetch to get a list of stack entries > and then use stack_trace_print to print this list. > Provide a helper in stackdepot to print stack entries > based on stackdepot handle. > > Signed-off-by: Imran Khan > Suggested-by: Vlastimil Babka You should convert existing users together with the patch that introduces the helper. I think print_stack() in mm/kasan/report.c, and __dump_page_owner() could use this. > --- > lib/stackdepot.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) It's missing a declaration in include/linux/stackdepot.h Perhaps it could be all be a static inline there anyway. > diff --git a/lib/stackdepot.c b/lib/stackdepot.c > index 1d42ef9ef766..eab4476b060b 100644 > --- a/lib/stackdepot.c > +++ b/lib/stackdepot.c > @@ -214,6 +214,23 @@ static inline struct stack_record *find_stack(struct stack_record *bucket, > return NULL; > } > > +/** > + * stack_depot_print - print stack entries from a depot > + * > + * @handle: Stack depot handle which was returned from > + * stack_depot_save(). > + * > + */ > +void stack_depot_print(depot_stack_handle_t stack) > +{ > + unsigned long *entries; > + unsigned int nr_entries; > + > + nr_entries = stack_depot_fetch(stack, &entries); > + stack_trace_print(entries, nr_entries, 0); > +} > +EXPORT_SYMBOL_GPL(stack_depot_print); > + > /** > * stack_depot_fetch - Fetch stack entries from a depot > * >