Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp191480pxm; Wed, 2 Mar 2022 13:12:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB4JDpSNPFqWrX9HuRmEucj4lbho8NtvEeHe3mOgv/W2NCnATNGQadHs/+yPkJeIE9bt9k X-Received: by 2002:a05:6402:430d:b0:415:c176:3fc0 with SMTP id m13-20020a056402430d00b00415c1763fc0mr4071926edc.358.1646255536811; Wed, 02 Mar 2022 13:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646255536; cv=none; d=google.com; s=arc-20160816; b=sNyP0iAjXk0DkxarS0uwlkuJcgo1kJuA4xBiTuLtOjAmJm47VCkGq5Nbx+qc083tXU PYREQ1eDIVSEjq53U+u5Pwgeh+IjCseKcU0fS9MqKTX9uGfrFqonjuk4SF4bbdNaoz3W a9nU0C4uFe+chOBEb0hWgPd78QjddgC+Mdw+sdcl/ZaazU/IlggLkV3+5dxR+iZZABMC GjRuyLyj3RCZp8FZzfLnDSI6p9W6swim/FhpXbfX88wx24jsOT+VrHZu0plxnD/RlGcy W/A1ljFQnQ7GtImMkqOMNo3GDB09CAdeSko4EKGaNnFBRZZxXvi9ymJG21ppw1LWq6DH nSmg== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=GCaIN4NRq1zNm/Cv/yO1rRvuzmntwatXQ6uVNZcnFSQ=; b=nMrFEKLWE6LeUfXqG4eGp2635wt2NddF4/Ch6ENyH6JKd7q+1zQY71vgphgpdayyHb LyIaZq8F9qfOXWoYvxFqt5Lv4vRsQYFIv/nsnqT6f8iBIkJ47lRm4Td8DW4O9SXF8JF9 jMPXdtAhedBEFfYuL8ssuIw0wYoy9Xp7xGAkrM883klTIPQPZSWbpQ+/sDILkKIeBbaU zTDcVXuGrUX05WUlxev9uz3PgYcUCsaz9XRaMbkRKQ1cbNyIUNp4TpWGbTgnTGczvkf6 aJX+3suFleV72FkocvdZOvDLIp5q/OqEjkY9ITFUE1M3kG6FA1S7IVLCpsshPdEDUSgu 8yPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ct4Xfp1s; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa20-20020a1709076d1400b006d8885a0cb9si122364ejc.289.2022.03.02.13.11.52; Wed, 02 Mar 2022 13:12:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ct4Xfp1s; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243182AbiCBQwT (ORCPT + 99 others); Wed, 2 Mar 2022 11:52:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbiCBQwS (ORCPT ); Wed, 2 Mar 2022 11:52:18 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E6FCFB99 for ; Wed, 2 Mar 2022 08:51:35 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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-out1.suse.de (Postfix) with ESMTPS id 9EBE8219A6; Wed, 2 Mar 2022 16:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1646239893; 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=GCaIN4NRq1zNm/Cv/yO1rRvuzmntwatXQ6uVNZcnFSQ=; b=ct4Xfp1snqnbqSKt3IQVOJVW0Qz+qWywPmqlDsL2R0w4GUZ9wvlXhFBx9Cj8EB8ArNvTbZ vJ9JxeTlzExKyJpjolWvjpGLUJc+Q1qCzqaeqGi7UTDeC3EvCzCS051nd0olWD95SfE8ZC ICX0koIkBuXpRdubK4/d6NHFH/zcxCA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1646239893; 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=GCaIN4NRq1zNm/Cv/yO1rRvuzmntwatXQ6uVNZcnFSQ=; b=iq+rEXHUQ6n3ylidmsfBwzJ/htC6EI9nCjbwLfqx6sWlgkal4LTkrfGidnKiCJ8rgj5spz 2Y9Lmd+xHPrzPNBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2470613A93; Wed, 2 Mar 2022 16:51:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FjUpCJWgH2KKPAAAMHmgww (envelope-from ); Wed, 02 Mar 2022 16:51:33 +0000 Message-ID: <4b6e9dbb-ba3e-f33c-956e-07b5f81deee8@suse.cz> Date: Wed, 2 Mar 2022 17:51:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 2/5] mm/slub: use stackdepot to save stack trace in objects Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: David Rientjes , Christoph Lameter , Joonsoo Kim , Pekka Enberg , Roman Gushchin , Andrew Morton , linux-mm@kvack.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, Oliver Glitta , Faiyaz Mohammed References: <20220225180318.20594-1-vbabka@suse.cz> <20220225180318.20594-3-vbabka@suse.cz> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 On 2/27/22 10:44, Hyeonggon Yoo wrote: > On Fri, Feb 25, 2022 at 07:03:15PM +0100, Vlastimil Babka wrote: >> From: Oliver Glitta >> >> Many stack traces are similar so there are many similar arrays. >> Stackdepot saves each unique stack only once. >> >> Replace field addrs in struct track with depot_stack_handle_t handle. Use >> stackdepot to save stack trace. >> > > I think it's not a replacement? It is, for the array 'addrs': -#ifdef CONFIG_STACKTRACE - unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */ +#ifdef CONFIG_STACKDEPOT + depot_stack_handle_t handle; Not confuse with 'addr' which is the immediate caller and indeed stays for redundancy/kernels without stack trace enabled. >> The benefits are smaller memory overhead and possibility to aggregate >> per-cache statistics in the following patch using the stackdepot handle >> instead of matching stacks manually. >> >> [ vbabka@suse.cz: rebase to 5.17-rc1 and adjust accordingly ] >> >> This was initially merged as commit 788691464c29 and reverted by commit >> ae14c63a9f20 due to several issues, that should now be fixed. >> The problem of unconditional memory overhead by stackdepot has been >> addressed by commit 2dba5eb1c73b ("lib/stackdepot: allow optional init >> and stack_table allocation by kvmalloc()"), so the dependency on >> stackdepot will result in extra memory usage only when a slab cache >> tracking is actually enabled, and not for all CONFIG_SLUB_DEBUG builds. >> The build failures on some architectures were also addressed, and the >> reported issue with xfs/433 test did not reproduce on 5.17-rc1 with this >> patch. > > This is just an idea and beyond this patch. > > After this patch, now we have external storage that records stack traces. Well, we had it before this patch too. > It's possible that some rare stack traces are in stack depot, but > not reachable because track is overwritten. Yes. > I think it's worth implementing a way to iterate through stacks in stack depot? The question is for what use case? We might even not know who stored them - could have been page_owner, or other stack depot users. But the point is usually not to learn about all existing traces, but to determine which ones cause an object lifetime bug, or memory leak. >> >> Signed-off-by: Oliver Glitta >> Signed-off-by: Vlastimil Babka >> Cc: David Rientjes >> Cc: Christoph Lameter >> Cc: Pekka Enberg >> Cc: Joonsoo Kim >