Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp875012pxb; Wed, 1 Sep 2021 11:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCq9XTvNbrggBMcaUBLEoRiCMigqkfwzX1iCRfYw4MFNkf+Sbpxeq2PiaqP0teivP4XuQf X-Received: by 2002:a50:cac7:: with SMTP id f7mr1080354edi.302.1630522288946; Wed, 01 Sep 2021 11:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630522288; cv=none; d=google.com; s=arc-20160816; b=o+Mm977spZ9oDg3a5rN5g3Jfp4yjLUorO4XZyoXE7g3kITVCfJBNAgFCeSy3LBxPxO PLYBqZaIEvTdUTl+RXY6qgYWG5O9WXht7rlj82bvsF9yx1NkSc0LxXiJUZnuf+W9bpbY ZhRZ3VLAn7n9ClgQCyGg4ChHNJeRTLYxsOu4CyLuTgza1uCsfi+VyRvHuix0Plla0evL 4Nwnc4NmzXS/2Fw0mF4b2jitCQnpx1uztdAsNAntSPbLuqepI18aclah5JoZ9mRoca9X +hg5aR7LrOd2da82ewijm9pDyQ48KPiZv6GDhAowUN2xqy27gCWP9OObj3AuexkeHLcg TT6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=z3jeCbfsUFcHiHKv3bA+MeCKvFKq2zsYwKYFQ0RSEWc=; b=n0p+0jhq6a0q3k00nMpX1RtliCPV1uAn8jisqCushn51dtry5+JORxwWp8i6pRmRve Q+Zk5qplG13/XHdwDxPDF7q4aSlQ2n7jTTUG4wDZF1zJFIflThHtJ46mAbi4gP41iVBL 6f5rW269RApiNc4iX/ZidJW71MqoGOTQ91lEXwdc3Yp17KiaoeifJEUxNwYWT7SVXY35 pHQo1a/zmqCI+tTlq22jmbEiE2YOe6NNcim8yXrQXav4QsVbTrIqH594WUQzAK/vg9O/ PcDZv+t2d0JiCj6Tebs6pGh0wgWFmak94AkqTihEFStnNzIcmPT7hbOJJt+B9wkL64Jb 1w5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=LteYd9tB; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si618195ejk.196.2021.09.01.11.51.02; Wed, 01 Sep 2021 11:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=LteYd9tB; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243392AbhIAJIg (ORCPT + 99 others); Wed, 1 Sep 2021 05:08:36 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:57120 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239862AbhIAJIf (ORCPT ); Wed, 1 Sep 2021 05:08:35 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > * >