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 27833C54E58 for ; Thu, 21 Mar 2024 10:50:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CE8D6B0082; Thu, 21 Mar 2024 06:50:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77EDE6B0085; Thu, 21 Mar 2024 06:50:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61F7A6B0087; Thu, 21 Mar 2024 06:50:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 53AFF6B0082 for ; Thu, 21 Mar 2024 06:50:42 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2652DC0AD4 for ; Thu, 21 Mar 2024 10:50:42 +0000 (UTC) X-FDA: 81920727924.17.39A014C Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf07.hostedemail.com (Postfix) with ESMTP id D2C7D40011 for ; Thu, 21 Mar 2024 10:50:38 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=TGV647uj; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="O0um/ZCs"; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=bf3yVEuQ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=UafGAvGq; spf=pass (imf07.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711018239; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3MkA3INDRNrQmyii/A1Er4UKsQqNsow2c9O8EOAoimo=; b=I1Hh2H8qqsuxbOVstoinWle1MVogEc04KWFC8hFoKgSKAsMQw8a0bFJmNxg2utI6linhQu 0iCkZmMC8gMw94qlkRIppWhIYHp7gydYo3igrweIt4q0OVJu9EcXw1/bZ8hZxdJbFdLHnd 738Q6RiG57kCIAHIVfZNqHgGkHEbYhc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=TGV647uj; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="O0um/ZCs"; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=bf3yVEuQ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=UafGAvGq; spf=pass (imf07.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711018239; a=rsa-sha256; cv=none; b=GwSZdE2FPZXKFs1vNtz1u0GkwlF4APTgOAdBrnv5gbFdjQZpOrpB9mwkmjHSqr7iWlc2oo ESZWevHuqWwlwIfZ9giwcm0KP2wzFzHh2FJ0tN2s70Fq11WnD9RyXJB8/TmiOGdjnZKXTF NbpPcwCANhJKtfczCpwgLFF5+6B5Lag= 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 E5EFB5CC90; Thu, 21 Mar 2024 10:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1711018237; 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=3MkA3INDRNrQmyii/A1Er4UKsQqNsow2c9O8EOAoimo=; b=TGV647ujMQMD9P/44azK1++hnYVprPTitT1iBwUxc3WKMcwcwAH+qmJZMY0PXCALBlbuRV xQk91wyrYLPY/JAWPV3hRUuOqg60Gp8/0nyy3Yq3FywIKc1OixnP2sIhwYPZw1uL0+mVYR sAgbJhwBRDOPJAgUkDgXqkSX9pGqIQQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1711018237; 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=3MkA3INDRNrQmyii/A1Er4UKsQqNsow2c9O8EOAoimo=; b=O0um/ZCsYEDTkSq6O/1z+N6jBNMwWroTr0EEDcPFJhvwkuFbvVeLLrsDQEG87XUWG3bA0A OkCyyjsCGI6Q8yCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1711018236; 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=3MkA3INDRNrQmyii/A1Er4UKsQqNsow2c9O8EOAoimo=; b=bf3yVEuQ0R7YJNEJO87pQGedAOLqemHiYI6CdtPgLob77SIfhK+/CZjpilvGPlZUq3n5sr rEZe7zEHzqYrgOW+TG++qOTOrXXMRAEmStMUJsRhOLIIznlFhagO71gakZ5lo9jNqXrtyN 3e2/UII5UXz4pxRqVbiHKJFQxy9ilH4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1711018236; 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=3MkA3INDRNrQmyii/A1Er4UKsQqNsow2c9O8EOAoimo=; b=UafGAvGqBrejNTrrT3Lsf9XntQh5zFs41qz06HNSy77C9TRt6So1WyXOQuow0DUEhTRiBP 3NnxdpRghbLSCSAA== 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 CD366136AD; Thu, 21 Mar 2024 10:50:36 +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 T2PAMfwQ/GUVJgAAD6G6ig (envelope-from ); Thu, 21 Mar 2024 10:50:36 +0000 Message-ID: Date: Thu, 21 Mar 2024 11:50:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] mm,page_owner: Fix accounting of pages when migrating Content-Language: en-US To: Oscar Salvador , Matthew Wilcox Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Marco Elver , Andrey Konovalov , Alexander Potapenko , Tetsuo Handa References: <20240319183212.17156-1-osalvador@suse.de> <20240319183212.17156-3-osalvador@suse.de> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: D2C7D40011 X-Rspam-User: X-Stat-Signature: pjoounimzih8885i1chwqqxozng7uzo1 X-Rspamd-Server: rspam01 X-HE-Tag: 1711018238-790835 X-HE-Meta: U2FsdGVkX1+Yfp59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qNsS4Z9BdhcWAp3MpAM5wNZKjcG1A/ydAc690OTnXq8D7rsNqsBaRwoGfwtm2eYohpK/4HCJT0WuhbCLEbpRvVZCznXMPh9A/ckh0z37wcx2AhBJF3LrCjXWeCsBQTsFWodVJyrr/I/2vBkK+FWqpTn9XGSo6Ez2c4rkgnhujwI8TOcCJG+KwqhH6BbEHV2nqWqfIIKcg== 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 3/20/24 06:00, Oscar Salvador wrote: > On Tue, Mar 19, 2024 at 06:48:31PM +0000, Matthew Wilcox wrote: >> Is this the right way to fix this problem? I would have thought we'd >> be better off accounting this as migration freeing the old page and >> allocating the new page. If I understand correctly, this is the code >> which says "This page was last allocated by X and freed by Y", and I >> would think that being last freed (or allocated) by the migration code >> would be a very nice hint about where a problem might stem from. > > I hear you, and I had the same thought when I stumbled upon this. > I did not know that the handle was being changed, otherwise it would > have saved me quite a lot of debugging time. > > Checking the history of this, I can see this decision was made in > 2016 in: > > commit d435edca928805074dae005ab9a42d9fa60fc702 > Author: Vlastimil Babka > Date: Tue Mar 15 14:56:15 2016 -0700 > > mm, page_owner: copy page owner info during migration > Yeah I think we could keep that logic. But we could also simply subtract the refcount of the old handle (the "allocated for migration") in __folio_copy_owner() no? Then we wouldn't need the extra migrate_handle. Also we might have more issues here. Most page owner code takes care to set everything for all pages within a folio, but __folio_copy_owner() and __set_page_owner_migrate_reason() don't.