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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E53B1C47073 for ; Thu, 4 Jan 2024 10:18:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B0FA6B0188; Thu, 4 Jan 2024 05:18:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 761BB6B02B5; Thu, 4 Jan 2024 05:18:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 602866B02B7; Thu, 4 Jan 2024 05:18:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4BF246B0188 for ; Thu, 4 Jan 2024 05:18:23 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1A9DF80821 for ; Thu, 4 Jan 2024 10:18:23 +0000 (UTC) X-FDA: 81641228886.10.0F79EF6 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf14.hostedemail.com (Postfix) with ESMTP id E5BEC100006 for ; Thu, 4 Jan 2024 10:18:20 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EMvMPWHw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Jco3uzab; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EMvMPWHw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Jco3uzab; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf14.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704363501; a=rsa-sha256; cv=none; b=GLRMsPiJVyinD0M+xz3sipTSa+Ft11eHK4lxgi4K2MmmsiGZ/PO1nYAb9JdY01ks62C+mX TFcfiqH9speXaAp75awoIBN7UbN8Z0MUfxDsoMbrPTC/rt1ZqoKg0ZJK/uWogsh45uqIXn P4AbpdCSujcx2Nm6QZXZnsRXcDhK2s4= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EMvMPWHw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Jco3uzab; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EMvMPWHw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Jco3uzab; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf14.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704363501; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Glk8o7g6rLUF+Y5xoK5c97MnCA6oOnTmvlAIcCHTwSw=; b=FMP3z5LKIa38q0kErNRE1cLPkLbYovIeu5FfyUj6J9JWPCWgsuPzJYWn+mfavKpvPH0NKQ 7EN56ATiIrWysLHLhrqsLbru8RaXKJ9848dvi3EYbs8isEmJjf419MdIYrB8zcgGokbNgo Z3RCB7+CZ/a9LaNKlpsfKeNzQc2GUyE= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 200711F7E5; Thu, 4 Jan 2024 10:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704363499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Glk8o7g6rLUF+Y5xoK5c97MnCA6oOnTmvlAIcCHTwSw=; b=EMvMPWHwOckOKt82lWh0kJhFu32+JtfJRRmsKS9L/xrxPK4tUG+nvZQWGU2XsZQcals0Js wVnpC/Y7aLlGVL5vang1EI3ev5ehrsWlQWRxBLUlb+qoTkKBNg6gi7QC9VF56szq+cB/Zp bU3K4w7Jcb7fY9qsPPabRYEBj/+it8o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704363499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Glk8o7g6rLUF+Y5xoK5c97MnCA6oOnTmvlAIcCHTwSw=; b=Jco3uzabqstMOqqWr/FKD1AnJyePQunZGPtaTTlKQjjyKdD9I0+L2jZWo3ycYLrzJbsNV2 0xXmQW9rAnKjflAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704363499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Glk8o7g6rLUF+Y5xoK5c97MnCA6oOnTmvlAIcCHTwSw=; b=EMvMPWHwOckOKt82lWh0kJhFu32+JtfJRRmsKS9L/xrxPK4tUG+nvZQWGU2XsZQcals0Js wVnpC/Y7aLlGVL5vang1EI3ev5ehrsWlQWRxBLUlb+qoTkKBNg6gi7QC9VF56szq+cB/Zp bU3K4w7Jcb7fY9qsPPabRYEBj/+it8o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704363499; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Glk8o7g6rLUF+Y5xoK5c97MnCA6oOnTmvlAIcCHTwSw=; b=Jco3uzabqstMOqqWr/FKD1AnJyePQunZGPtaTTlKQjjyKdD9I0+L2jZWo3ycYLrzJbsNV2 0xXmQW9rAnKjflAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 413F5137E8; Thu, 4 Jan 2024 10:18:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id /st8DOqFlmVUbwAAD6G6ig (envelope-from ); Thu, 04 Jan 2024 10:18:18 +0000 Date: Thu, 4 Jan 2024 11:19:09 +0100 From: Oscar Salvador To: Marco Elver Cc: andrey.konovalov@linux.dev, Andrew Morton , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: Re: [PATCH v4 17/22] lib/stackdepot: allow users to evict stack traces Message-ID: References: <1d1ad5692ee43d4fc2b3fd9d221331d30b36123f.1700502145.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E5BEC100006 X-Stat-Signature: pwzoi3e1canzaenf1z9iq6ch6yr1164r X-HE-Tag: 1704363500-628593 X-HE-Meta: U2FsdGVkX1+BZjDHw6PAX3WI6RWRX+apXaUTe5A+qijUjZHpQ6r6859cFtSU7gjB2NcQIfFVMN39k7W4U72tUYPFB/pLbHBKOLcrm4X7i3sNSvJVnANcpT8LYz9XxfyVNu4Re39hUgqaMkywpeWDCe8gZTbjc2Lp1ShOG8pAqdY7Nl3VNPD435dzzDzl2JG3q0fQskDnckJMY061cLuina6EJgcXDod9wu32vZueVKxxIMV/3t1NoLavqrcB5UBnwNXLuqHnAqPuAnfk+jFKr5mL6R0tB94mHK/mAUbFED3yuWX1lXzyRgiYf/EceQeEsscxeiNM6SsgMYGn+r5AQ58qkW4I1v2uJqrNMMFSnA64TYTb7ddaqmA1rkx5qhtaXuvQEeqbQtHweqbTj0rEOS1Rq0u3rVVc+swDNb15kfCBeqhvb1HiQTEJh0J1bnnztivjH68OUVusycrTjZNWfuf3q/eEw/Wt6JBoBkpWKqzeMEORnIgJ7Xm0OsuARCM7zrh9lJeUMRb5HSF/jbyGRVAIeSt4OqSHrPy+q4b84FSGO/whva8YGsFVGVG0e4peqL2px996+65RStlbdK30Kyuy4VabQXxAx+LX2HnNHUlo2IhT50wxNbXCX5Q8we0O2zj3uUov+0FOkbTecFBxWPn6f3EQFmhvkcbxcaadZiNRBrJm39mPJM/PhAt1ECK/gpX6wzDJRWl5QmkO6sG41k1720zOxyiLHgsp37baS9xH4+Nq5oROf7mzO1rC6Tb3ySxIVDQqSybNKiPicDsuYpZMWr+WaNxS7ifAqSCNn5p8NgKtuZG1jk4nWuy2/zJZXGB4nvDCknDDXI5Nqr7JTHldCKnqID5wL8gxrhIm/rnIr2KulXQkCC7A1Qo3YzMw 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: List-Subscribe: List-Unsubscribe: On Thu, Jan 04, 2024 at 10:25:40AM +0100, Marco Elver wrote: > I think a boolean makes the interface more confusing for everyone > else. At that point stack_depot_put merely decrements the refcount and > becomes a wrapper around refcount_dec, right? Thanks Marco for the feedback. Fair enough. > I think you want to expose the stack_record struct anyway for your > series, so why not simply avoid calling stack_depot_put and decrement > the refcount with your own helper (there needs to be a new stackdepot > function to return a stack_record under the pool_rwlock held as > reader). Yeah, that was something I was experimenting with my last version. See [0], I moved the "stack_record" struct into the header so page_owner can make sense of it. I guess that's fine right? If so, I'd do as you mentioned, just decrementing it with my own helper so no calls to stack_depot_put will be needed. Regarding the locking, I yet have to check the patch that implements the read/write lock, but given that page_owner won't be evicting anything, do I still have to fiddle with the locks? > Also, you need to ensure noone else calls stack_depot_put on the stack > traces you want to keep. If there is a risk someone else may call > stack_depot_put on them, it obviously won't work (I think the only > option then is to introduce a way to pin stacks). Well, since page_owner won't call stack_depot_put, I don't see how someone else would be able to interfere there, so I think I am safe there. [0] https://patchwork.kernel.org/project/linux-mm/patch/20231120084300.4368-3-osalvador@suse.de/ -- Oscar Salvador SUSE Labs