Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3121021rdb; Tue, 13 Feb 2024 07:28:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXxMfV3vvksMuvz6KdGhV5I2VEbGV1Os1mW/FhdMJSLMLAQXaZqda+17k6Ag9rkS+Fm45nnsbD1clnHTzVgc3ji2aOglrEadopTenuF6Q== X-Google-Smtp-Source: AGHT+IHfepckV8CfL5O1rtYb+6mYGjCp4vQjhd8WLuNEpXxpPpOOP6kTUE/vlNje3uKw2fj2MQTZ X-Received: by 2002:a05:6512:31d6:b0:511:51a2:e9c4 with SMTP id j22-20020a05651231d600b0051151a2e9c4mr8998279lfe.15.1707838120366; Tue, 13 Feb 2024 07:28:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707838120; cv=pass; d=google.com; s=arc-20160816; b=fY6Lk4b/aWIW9dN9MMvElpUB1GVD/mZs14EzOb5WTfTSFsgvubsrBC5CvgR/QwTq86 ncusmKmlmIrSl9j5lkxrws/ho0VKn2bRUsITY6sOnkLvokrjpGIG2+vRSRw6GIIp9zti hkjltjmga/AMRinCBvp+FMz4bLnCXnxJaKqHTXwvKYiD9m+RScmAc9q5cPqaaS63ObpD HtrBNRa5BBoL2uXpf42IlkBNd7LvPQMI7whj9aswvfVvCJq8jUdcw41uYVRzXGVdYJ10 tJjfQYt0mipoHpFIMQWMdmGTjqd2nwgoKhncfZVZUVms2N4yfF5XRQ2ORz9K5tbagyms P7/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=UOqyyr9J8HQa/t+lFwrZoSXmef4Harx/aN0fYbsHfuw=; fh=H8QUj4qXUc+3S3VYrG4zgdq7vsVP/iKMDIbFmaIFIBg=; b=w44IfzWnkCMllUyKPmytlA03R4Qrj/+HmCebeGShST4EWCV6+Vq5nVZkySL7xYU+Aa xSTmU6wlyOLM9PE8yYfEWhvrj0X/5ZYbnCBJf1T7IegLiC6s334uRlMisqIGHDBMhAjL 4KShCtyvitETDCH8YyJaxPfDSmSF0ZHj5czppS4jOhhOF41RPwSqVgWJyfXbYLH6rjD0 bQcQK6WcxVxL1t7BS4OcXuH21nIhyPYcBLLCEmj4CNrIcejofZhDnIrC8HP/kBAlN/6g cwp6Pss7TPnR0gWDYpFKvGM1UACAULSEDHb88E4IuWxhG75xOPFVPsLmbZGlkinZKpnh EyOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=s9snqPdm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=s9snqPdm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-63801-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63801-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=2; AJvYcCXnU/rnk4moobTQK72ZVXAh81SMMw5HUYiEvdDHikUHkXKDLGEYBvgnsMI8VPPoW5Rvd3aJNLXKBpW7BkEbdszInfJnuXdBR1Np+JEiqw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gb37-20020a170907962500b00a3cecdeb74dsi1041043ejc.586.2024.02.13.07.28.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:28:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63801-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=s9snqPdm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=s9snqPdm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-63801-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63801-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E8DE61F24E0A for ; Tue, 13 Feb 2024 15:28:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 032265DF37; Tue, 13 Feb 2024 15:28:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="s9snqPdm"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3G41LElH"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="s9snqPdm"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3G41LElH" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95ED05DF1F for ; Tue, 13 Feb 2024 15:28:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707838103; cv=none; b=WlzmSOxbeB2bF4AZ8rGghhG13opwYrMug2amgeeFTLTCkl0X2Kjo+Fwa5zSXNfSWljjl6zZiycrpyTN9nwYS8YDBHTc256uZbnpxVWsFLe3WCyLFTrO5rm3/yBtXKqSVdRwO73PTsrE4BQpeoTWnbHU4QE55K3Ki74sa2iBn2bw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707838103; c=relaxed/simple; bh=Rr2j/IFiXol9Mw+JdHIp1YqM70+RP6dRKHr/Kkpocsk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N8vUxzhF6Z+N7rjmSPWhEjDXI1+DN6ayD0qThWbibIQJaQ8XbFPTp59WR2/xQsJ8w+NRNflBMb+rfYexWeJeCmKwhoKQ/c6xamLeB9fn5lGit2Nn/u3tgqDdXzXLVF5mI27KERa+68u955asG9nsCQhGepmnSvaqz9v+D/L6Das= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=s9snqPdm; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3G41LElH; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=s9snqPdm; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3G41LElH; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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-out1.suse.de (Postfix) with ESMTPS id BC0C121F56; Tue, 13 Feb 2024 15:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707838099; 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=UOqyyr9J8HQa/t+lFwrZoSXmef4Harx/aN0fYbsHfuw=; b=s9snqPdmjc0zE/IWEh7KNMpJIvChwViTVyraSTzNTLOzzr/0Onf6O/x11sPa27GJ5kiIcs b3xrhw3zQOaSF8yUwuC2jzIPRRfSCJOuqhhY5an0VrmBP7BSW8J0rQ4+FTM8+m+dmLfnms Iq73rl3G2QCAZhVOgNzASXinHvaiyGQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707838099; 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=UOqyyr9J8HQa/t+lFwrZoSXmef4Harx/aN0fYbsHfuw=; b=3G41LElH0mWmFp3mfaiiLSZLKdMgQ/TyT4p978X73j3rv+uO5b5gweuImbQbibhiMBr+O8 ZQtb4hH1E45S5ICg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707838099; 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=UOqyyr9J8HQa/t+lFwrZoSXmef4Harx/aN0fYbsHfuw=; b=s9snqPdmjc0zE/IWEh7KNMpJIvChwViTVyraSTzNTLOzzr/0Onf6O/x11sPa27GJ5kiIcs b3xrhw3zQOaSF8yUwuC2jzIPRRfSCJOuqhhY5an0VrmBP7BSW8J0rQ4+FTM8+m+dmLfnms Iq73rl3G2QCAZhVOgNzASXinHvaiyGQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707838099; 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=UOqyyr9J8HQa/t+lFwrZoSXmef4Harx/aN0fYbsHfuw=; b=3G41LElH0mWmFp3mfaiiLSZLKdMgQ/TyT4p978X73j3rv+uO5b5gweuImbQbibhiMBr+O8 ZQtb4hH1E45S5ICg== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 4220513A0E; Tue, 13 Feb 2024 15:28:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id kxJfC5OKy2ULfAAAn2gu4w (envelope-from ); Tue, 13 Feb 2024 15:28:19 +0000 Date: Tue, 13 Feb 2024 16:29:28 +0100 From: Oscar Salvador To: Vlastimil Babka Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Marco Elver , Andrey Konovalov , Alexander Potapenko Subject: Re: [PATCH v8 2/5] mm,page_owner: Implement the tracking of the stacks count Message-ID: References: <20240212223029.30769-1-osalvador@suse.de> <20240212223029.30769-3-osalvador@suse.de> <8ff46f99-d167-448f-9aae-a634b8aae4d0@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ff46f99-d167-448f-9aae-a634b8aae4d0@suse.cz> Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-5.44 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[8]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[linux-foundation.org,vger.kernel.org,kvack.org,suse.com,google.com,gmail.com]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-1.34)[90.43%] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -5.44 On Tue, Feb 13, 2024 at 02:42:25PM +0100, Vlastimil Babka wrote: > On 2/12/24 23:30, Oscar Salvador wrote: > > __set_page_owner_handle(page_ext, handle, order, gfp_mask); > > page_ext_put(page_ext); > > + inc_stack_record_count(handle); > > What if this is dummy handle, which means we have recursed in page owner, > and we'll by trying to kmalloc() its struct stack and link it to the > stack_list because it was returned for the first time? Also failure_handle. > Could you pre-create static (not kmalloc) struct stack for these handles > with refcount of 0 and insert them to stack_list, all during > init_page_owner()? Bonus: no longer treating stack_list == NULL in a special > way in add_stack_record_to_list() (although you don't need to handle it > extra even now, AFAICS). Good catch. I did not think about this scenario, but this could definitely happen. Yeah, maybe creating an array of 2 structs for {dummy,failure}_handle and link them into stack_list. I thought about giving them a refcount of 1, because we only print stacks which refcount > 1 anyways, but setting it to 0 has comes with the advantage of catching spurious increments, should someone call refcount_inc on those (which should not really happen). I will try to implement it. Thanks -- Oscar Salvador SUSE Labs