Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5089042rwr; Sun, 23 Apr 2023 21:08:45 -0700 (PDT) X-Google-Smtp-Source: AKy350aCCsU6oe+1LG4qfkfTpF3dq3yRHT8oPvPVTVPsXTRAWdTtKzMQ6fxSlVIoinDSETbhh4wa X-Received: by 2002:a17:902:70c7:b0:1a5:dfd:d167 with SMTP id l7-20020a17090270c700b001a50dfdd167mr3548070plt.8.1682309325276; Sun, 23 Apr 2023 21:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682309325; cv=none; d=google.com; s=arc-20160816; b=epYxkZQZ67NE2lLrrzgm6myOERs4Rv5nQWVCr2nQAk9DwrwGtKDlot1Lyz3hYdmdi2 TvKL8Tf7DcjPGB0y4Dk5N2FAvn6xj0vnOXkawlIwFaEUfhLrii5Ke32lfYnWFOC+Q4Et N6g0kP/jI+BOfzJCby8PNVrbJq9hj5o3VNgamp6U6kzMNQ+Sf+D3gSujEPX7NK690RUK Qgv7K1g8q6tS9g4f7ipyZwM21YwTX4gIaIz0Pbl2yelCwJx0V6PjSM1VAKFf3MvGqtFK y7712ZepE8ACzuxyYcpAXjzME8qzKKX10dLHCMSxCX0fLCTr2shyNmBV7MUx2idMWXsO AV0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature:dkim-signature; bh=Vg+urJOyPUXiktXOQU10CHhl7LlrECD+nld2cuF6aAk=; b=guXhiWAP+EiQ7rfiIRrGgzdJUxcdo6fkNuM3YRCB6U4Ilz59LhKz5+kLSpcwN5FOdR KuMpV2u6JbtIubkn7wC274qQraICDxQb0tL/SId8l5ieXWtSiam8WFGInRk3ozj/l+wx Jynwv/gxcjQvv1jy7FBiKO961HYHthusyDbDE0ljKBK1JwORaPwm1I8Pp3d/E4s0pUe7 7rEAXdiK4MqzDShZdZ+XQJl1/wIWSgLiRMK7WJv80PAAgpH7WsgPGEwUZCa4/a9/OBy8 PBUO15XSH68q+2+rQa8y4M2PxL/xs/hZVCmU/LuLwu2bRx/B3fHhA4UhnmK4XO3K+YHV DTSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eXxfKsWN; dkim=neutral (no key) header.i=@suse.de 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020a170902b71300b001a67b6db120si2310535pls.409.2023.04.23.21.08.29; Sun, 23 Apr 2023 21:08:45 -0700 (PDT) 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.de header.s=susede2_rsa header.b=eXxfKsWN; dkim=neutral (no key) header.i=@suse.de 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbjDXDzF (ORCPT + 99 others); Sun, 23 Apr 2023 23:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbjDXDzD (ORCPT ); Sun, 23 Apr 2023 23:55:03 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0F6526A3 for ; Sun, 23 Apr 2023 20:55:01 -0700 (PDT) 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-out2.suse.de (Postfix) with ESMTPS id E27D31FD6F; Mon, 24 Apr 2023 03:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682308499; 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=Vg+urJOyPUXiktXOQU10CHhl7LlrECD+nld2cuF6aAk=; b=eXxfKsWNO4lyj2ZqXMq+bLIHNTSri+lag0/Bt6xEzK1A+TjoA/ppj24WE6Z1sF+fGLd+nW gnjU0yXqwXwLBlSV54buUrxRY9QWR1+V4Lxiif+B6xUwwS1UvZcx5J7uamZvAyL869V8k7 X3r+wxUpm7KjPh/LX/D6AVZAzNT6XMg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682308499; 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=Vg+urJOyPUXiktXOQU10CHhl7LlrECD+nld2cuF6aAk=; b=6NxXkrOVVasLN3rwHOVjtak0p+7NjeNVXBEJZ/yOqxLmlj/U278PBU9oAc3CIM5kTIw8/H UozyMYX3r89C08Ag== 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 D374513780; Mon, 24 Apr 2023 03:54:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /PJrM5P9RWSUaAAAMHmgww (envelope-from ); Mon, 24 Apr 2023 03:54:59 +0000 MIME-Version: 1.0 Date: Mon, 24 Apr 2023 05:54:59 +0200 From: Oscar Salvador To: Alexander Potapenko Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Vlastimil Babka , Eric Dumazet , Waiman Long , Suren Baghdasaryan , Marco Elver , Andrey Konovalov Subject: Re: [PATCH v4 0/3] page_owner: print stacks and their counter In-Reply-To: References: <20230421101415.5734-1-osalvador@suse.de> User-Agent: Roundcube Webmail Message-ID: <7718244879ff2b696ea9cbb744cb3805@suse.de> X-Sender: osalvador@suse.de Content-Type: text/plain; charset=US-ASCII; format=flowed 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,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 2023-04-21 13:19, Alexander Potapenko wrote: > I think the implementation of these counters is too specific to > page_owner and is hard to use for any other purpose. > If we decide to have them, there should be no page_owner-specific > logic in the way we initialize/increment/decrement these counters. Another solution would be to always increment the refcount in __stack_depot_save, in this case the "page-owner" specific changes are gone, and it is more of a generic thing. e.g: Andrey Konovalov mentioned that in a future KASAN remodelation, he would be using a stack refcount as well. > The thresholds in "mm,page_owner: Filter out stacks by a threshold > counter" should also belong elsewhere. That can certainly be cleaned up I guess to not polute non-page_owner code. > Given that no other stackdepot user needs these counters, maybe it > should be cleaner to store an opaque struct along with the stack, > passing its size to stack_depot_save(), and letting users access it > directly using the stackdepot handler. > > I am also wondering if a separate hashtable mapping handlers to > counters would solve the problem for you? Let us see first if with the changes from above the code gets to a more generic and clean stage, if not we can explore further options. Thanks for your feedback Alexander! -- Oscar Salvador SUSE Labs