Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2127481rdb; Sun, 11 Feb 2024 12:41:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW9OrfB3wGyba3gFTytsGiIreLrw7sq8X/t2515yTuI0GXv5KE9LH7XY3hwsuJ8EUbbID/36+70bVgeijLeoywTo3ez03y+pCEdPKK24g== X-Google-Smtp-Source: AGHT+IF1lpxmvegUj0bmJpYTm1S5ECZg7FZLgaUXUZ+cHJs9odGzs852dw8w+UUhuTVl3/XVlRUN X-Received: by 2002:a05:6830:2b23:b0:6e2:df61:ff22 with SMTP id l35-20020a0568302b2300b006e2df61ff22mr3195918otv.7.1707684097464; Sun, 11 Feb 2024 12:41:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707684097; cv=pass; d=google.com; s=arc-20160816; b=U4fOVY0gZ8b98vPYP3R9a2UKScRve9jucjMCYsrRDc40OsBrf8i+n1+XeY0eApTVgh uUDOG+uAyRTnRbGQBg5Hr2ZeuWG5YRJigJDRfI3NN1i7e5fKNGlG13euQsetdE61pf9M E3gSe4t/3sls3AXvwRipqabHGL9qgdijn4bQaAO5wK3q/IYB28hBZD+hsEx/gEpuZGlO q0pbQRUqaJPT0zqOQyvDCC7tzNXAysWHDGhMFd0a2gca10O4vKkldXWLQKE9VybJ2/MI E3sD4HLOJTeRqpn850A11HqU4HgRpk0Zx3fTpE5CcTmZsi7Dlue0UE9CpNFFmq1piyD7 9ALg== 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=WcBULlLtnxtGKkTdBEx595CYX4r6oCzp34j9F9t8PSI=; fh=UV6D540Va28o0P7J9iIDNDVeThxLosOfJcMRXQ/Je9E=; b=pTLBk+3NkPBVuDcG1eS0BEM/tPKt7SYxduB4/dZSY6jMFCm/T8LsNnDg4q0ji4HICR QyBYpdn2KfLfV7suVHiX3REbO8nBKT8Se9/41nfhwMwnBp/EVkYW131SGuA0ivU2Cctj DCsSLvxjvMvEXvNxTcn+647eJxJRz0hRQz7E7qYflIdBzvSBF2/evgCUKMUOfofgtLb1 lT3lI6eb//Dd12RWtESbRuyfBJbT5ngM8iF3y8ugPanE1+eC/xQX225glMdvaostXFWl GWjgFSneo/tZMH695mqg4YxDGoF0ZE3Z6ITaXCXMFD8DtjX2OAUIScisAL1sJcC/FAMM tuTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MyXTaJiR; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MyXTaJiR; 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-60950-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60950-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; AJvYcCWCXqfSaKpabgTYDwgYgbLa/goSZMbaOl2FqPX8mCUDSLeEQColhmJ7k3mkiRGOJrVih1oZvz1SizJprIQ6xI+D2weKrD9CLENhQxsoug== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d30-20020a63735e000000b005d2c05c7039si5372950pgn.865.2024.02.11.12.41.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 12:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60950-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MyXTaJiR; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MyXTaJiR; 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-60950-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60950-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 19D46280D9E for ; Sun, 11 Feb 2024 20:41:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 783705DF09; Sun, 11 Feb 2024 20:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="MyXTaJiR"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="J7a71SOP"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="MyXTaJiR"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="J7a71SOP" 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 B80F35915F for ; Sun, 11 Feb 2024 20:41:27 +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=1707684089; cv=none; b=UKrLUxKNwasV4VQ97NJJD1gO4yYk6tEcJcDt0Xr9/HX4n0iO7u2PXHRQZ26/xmuy8Dknjaks96kp4C2IgNSVsb4XrozCFDBehjoosazdAp8mESGeRrc5/rnUMbdAkm5JkSib5uXfk5uBVRL3RGhLVT1GOXy1Mi7WQevBNwjahCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707684089; c=relaxed/simple; bh=KeeJC2cmwuE1J/AWaVxDn8o/BCU/xBQsmqmcsSzDR7I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tbWWJlhobcfnovL6fhKJ9Nppt0zbkwjbhmBC78OolIi9LAv0HrkgJAjalWKJCYX9TWUVunA/XIcdU1V6EP7mzHYhZstZo2nG3nR8MNid1j3LQn9ydRxojtcoNcHI9Vz83lYDVXKZttRgBAjViKixGEGnzi6xb4+azFA1pwJdFu4= 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=MyXTaJiR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=J7a71SOP; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=MyXTaJiR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=J7a71SOP; 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 imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id 91288210F5; Sun, 11 Feb 2024 20:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707684085; 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=WcBULlLtnxtGKkTdBEx595CYX4r6oCzp34j9F9t8PSI=; b=MyXTaJiRalkoTp+bf2JxHPLrBfP+1XwD2SH3prRHwpdfV85NcIemiGwR0kGjvn/ASCKU13 +D2A82g10t2f/1vQg13JRozSsix2lru7XfugMSrTcfAmZISuFoeVUCeE77cBU2l+czmtHk RSXzQyqzLGy76dabmlruUjeBk9orNsA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707684085; 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=WcBULlLtnxtGKkTdBEx595CYX4r6oCzp34j9F9t8PSI=; b=J7a71SOPBbU5a015CX+2Ux6ut3dh/FRXuGG88uKovPInErFi3bWcHrUj6fHtSMIbvRHBMj hcXz/beBwt8QzXDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707684085; 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=WcBULlLtnxtGKkTdBEx595CYX4r6oCzp34j9F9t8PSI=; b=MyXTaJiRalkoTp+bf2JxHPLrBfP+1XwD2SH3prRHwpdfV85NcIemiGwR0kGjvn/ASCKU13 +D2A82g10t2f/1vQg13JRozSsix2lru7XfugMSrTcfAmZISuFoeVUCeE77cBU2l+czmtHk RSXzQyqzLGy76dabmlruUjeBk9orNsA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707684085; 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=WcBULlLtnxtGKkTdBEx595CYX4r6oCzp34j9F9t8PSI=; b=J7a71SOPBbU5a015CX+2Ux6ut3dh/FRXuGG88uKovPInErFi3bWcHrUj6fHtSMIbvRHBMj hcXz/beBwt8QzXDQ== 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 172E213985; Sun, 11 Feb 2024 20:41:25 +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 +t/iAvUwyWXnUAAAD6G6ig (envelope-from ); Sun, 11 Feb 2024 20:41:25 +0000 Date: Sun, 11 Feb 2024 21:42:33 +0100 From: Oscar Salvador To: Marco Elver Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Vlastimil Babka , Andrey Konovalov , Alexander Potapenko Subject: Re: [PATCH v7 2/4] mm,page_owner: Implement the tracking of the stacks count Message-ID: References: <20240208234539.19113-1-osalvador@suse.de> <20240208234539.19113-3-osalvador@suse.de> 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: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=MyXTaJiR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=J7a71SOP X-Spamd-Result: default: False [-4.44 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; 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]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[8]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; 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,suse.cz,gmail.com,google.com]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.13)[95.83%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 91288210F5 X-Spam-Level: X-Spam-Score: -4.44 X-Spam-Flag: NO On Fri, Feb 09, 2024 at 10:44:23PM +0100, Marco Elver wrote: > > > * set a refcount of 1 ourselves. > > > */ > > > if (refcount_read(&stack->count) == REFCOUNT_SATURATED) > > > refcount_set(&stack->count, 1); > > Do you need to inc the first allocation? Should there be an "else" > here instead of always doing refcount_inc()? Yes, I need to inc in the first allocation, otherwise on the first free op, refcount goes to 0, and when the next allocation comes around, I will get a warning because of going from refcount 0 to 1. -- Oscar Salvador SUSE Labs