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 0EA73C3ABBC for ; Wed, 7 May 2025 03:30:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 359A46B0085; Tue, 6 May 2025 23:30:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E1486B0088; Tue, 6 May 2025 23:30:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 181DA6B0089; Tue, 6 May 2025 23:30:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E65846B0085 for ; Tue, 6 May 2025 23:30:46 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AA7E11CE0FD for ; Wed, 7 May 2025 03:30:47 +0000 (UTC) X-FDA: 83414684934.14.186747A Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) by imf04.hostedemail.com (Postfix) with ESMTP id BD26840004 for ; Wed, 7 May 2025 03:30:45 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CigDcurq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf04.hostedemail.com: domain of muchun.song@linux.dev designates 91.218.175.177 as permitted sender) smtp.mailfrom=muchun.song@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746588646; 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=qowYpm3BAfgX31Aen7B4hyVsFkHKwyebwwN0Uq02GZI=; b=kbtRQGOdQPRVprqZvqdMIPFfqQKGoQ+yxGB2V+Ox9twNonHrAeEElC5ufjbs8MS8yy1RZC Oo7Z+eYiZzSk6GqJCg4GWq7XGvZCDvidcpSuIwepmncZkiqPNtiokhKvWs6KjogghgIqrG EUSZdnV2LAVxV2DdWDkfs5GXmI2NpxE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746588646; a=rsa-sha256; cv=none; b=G+h0UGdi0f15fRlr0kVkr+MiNzMNuDjz6fldaFSv1IiwenjgVAM65kHae38HlvkIZJaGpw zy7wJezpgBohVRJUDUaqCT4yb7w4nfymjcX1xzcIFTeyg+yh7oT1GQFNxoTnRQvMwpfL9v yZCsBcDgB5AhE+IwsNC5Ucde8VIxVIM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CigDcurq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf04.hostedemail.com: domain of muchun.song@linux.dev designates 91.218.175.177 as permitted sender) smtp.mailfrom=muchun.song@linux.dev Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1746588643; h=from:from: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; bh=qowYpm3BAfgX31Aen7B4hyVsFkHKwyebwwN0Uq02GZI=; b=CigDcurqPGRd8k5xSbpf580mvx+9WkVag2UWKtb4AN06/0wy+xnZ9jslOaKFCy+tCBfh6i Dflh1yLTPUZTotl+GWXwynmNCNtaF5VzOW2uYq3EcnD0hWmjmJ9UQ8JahTJrkDwmFUGe3N YOansLkXgmo9MnmdUD9ujQhsLtfve+Y= Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: Re: [PATCH RFC 07/28] mm: thp: use folio_batch to handle THP splitting in deferred_split_scan() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <7fd0262d-ff36-d621-191e-4f623a2038c0@google.com> Date: Wed, 7 May 2025 11:30:01 +0800 Cc: Muchun Song , Johannes Weiner , mhocko@kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev, akpm@linux-foundation.org, david@fromorbit.com, zhengqi.arch@bytedance.com, yosry.ahmed@linux.dev, nphamcs@gmail.com, chengming.zhou@linux.dev, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, hamzamahfooz@linux.microsoft.com, apais@linux.microsoft.com Content-Transfer-Encoding: 7bit Message-Id: References: <20250415024532.26632-1-songmuchun@bytedance.com> <20250415024532.26632-8-songmuchun@bytedance.com> <20250430143714.GA2020@cmpxchg.org> <235f2616-99dd-abfa-f6d1-c178d8ffb363@google.com> <7fd0262d-ff36-d621-191e-4f623a2038c0@google.com> To: Hugh Dickins X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BD26840004 X-Rspam-User: X-Stat-Signature: ayjo5wwyuh7yrhmgwgum9ukuzgmki6mn X-HE-Tag: 1746588645-129035 X-HE-Meta: U2FsdGVkX1/1kahpIpmvgrbGLm/dpzFI99dI9imbDNlVanoEVsh2O7x4Qjdz0J3jqtJYKd0mzlkrId8FWG4ByuFEuc804e5nA24bJhOcntFfhope/ulsepfSeaPvfwBlHuGFEL2uVrCUzHxv5X2tnzGXuf+pfDGwUmfarYd1YT2p2vkP2TRsYYitfLlUS1qdCXg7DYsCmg0irgBmez7PUVvDYcTfJEsVxDMTdvmgK9xrnqqj90NYGsgLsVSsH7QgUU0kj/hUxOouBWwhiz6dhdqXW1qtt1A2Cc/Q55QUcDnIPwwBaOSIR8U0r3kyN5bnZ3qEMITxYymphzdsuqe3OpQXS3Xa5V7UZ3Xkc7Kc/tK0EWWryjGzY4towkec0gWRJaH34YK9ShbL0DgF5oW3FCJIQDITs+jR4wnUdEtL5cpB/U8KfYha4PzIpbwCT7zFOb1HWL5rMXogIGCSlVH8QYwJ7qFHu+V8/cABmnB2mareQ+dI8KRlsD0MumXNpEPLeG0/JFG2DTp7+4iLnUAKC7pmy+pF3+v1BymgbGrsMbiCmAIXodoYrCsfY02ze5xGGYBMugrXxVVUdzBGZ6w+sghR1ERDUUWZmHSf3Sf8SHBHeqePyeYUiqaETTNaHut6F5WXU1GQN7uCgiQaLNlecHiVcCDzKMNoLqVkI7q6NoaHLPpbCPU6NbNLNhpyIAdfvAIUo5gjeCQqN4IWVVzOKMLwnlC5tcwevJ/IUjYhLT6x7/NumpFsLrdNQlir/vVF7G1vmzGhn/mqvApw7LTBSd0UStZKGjh0OYYxpm0OTYgNTausYpfLniUFP14xlxqgEAB17o6W8EErq7u1++cH+jwSbLUHYN/aeQfjJSTP4j83LWaU3MIF2BBQP6YW2O5VnIyyo2+COYwNxkVTdcsKhety2bOvHFr678g3JjjqOUCmNTnfTPUEfj0gZDIh/UTawDL5rBOXwVSwiZZeG6Q za/aQJwD QodS+6Ug4dR48skqNUz6fRcU4JraPickk5kpoz5LzYMPCsY7MwJaVCqpqE/wrlciPVyQwcuB0gSKXBGnp3ZnFhcCKt8P/7kTVX7G/ooK1nenb5sdzPeMoDzlIIijycGdBROOqESabgs8kJXl34vFXaW0qIhCeMSjLr8wz8xvJR2qlL9VTdR/Qvm5vaPPGNREJvyuYEijTWp0xeZcOjDVBoRPZC0kkbUUgam4kfMUGAc5uKP80isP7NFzCV1Ltx9KVJqThCYPAh1TrSNxbCSHOaxjomzsFeZnrlKX+ 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 May 7, 2025, at 05:44, Hugh Dickins wrote: > > On Mon, 5 May 2025, Hugh Dickins wrote: > ... >> >> However... I was intending to run it for 12 hours on the workstation, >> but after 11 hours and 35 minutes, that crashed with list_del corruption, >> kernel BUG at lib/list_debug.c:65! from deferred_split_scan()'s >> list_del_init(). >> >> I've not yet put together the explanation: I am deeply suspicious of >> the change to when list_empty() becomes true (the block Hannes shows >> above is not the only such: (__)folio_unqueue_deferred_split() and >> migrate_pages_batch() consult it too), but each time I think I have >> the explanation, it's ruled out by folio_try_get()'s reference. >> >> And aside from the crash (I don't suppose 6.15-rc5 is responsible, >> or that patches 08-28/28 would fix it), I'm not so sure that this >> patch is really an improvement (folio reference held for longer, and >> list lock taken more often when split fails: maybe not important, but >> I'm also not so keen on adding in fbatch myself). I didn't spend very >> long looking through the patches, but maybe this 07/28 is not essential? Hi Hugh, Really thanks for your time to look at this patch. 07/28 is actually a necessary change in this series. > > The BUG would be explained by deferred_split_folio(): that is still using > list_empty(&folio->_deferred_list) to decide whether the folio needs to be > added to the _deferred_list (else is already there). With the 07/28 mods, > it's liable to add THP to the _deferred_list while deferred_split_scan() > holds that THP in its local fbatch. I haven't tried to go through all the > ways in which that may go horribly wrong (or be harmless), but one of them > is deferred_split_scan() after failed split doing a second list_add_tail() > on that THP: no! I won't think about fixes, I'll move on to other tasks. Thanks for your analysis. I'll look at it deeply. > > Or does that get changed in 08-28/28? I've not looked. No. 08-28/28 did not change anything related to THP _deferred_list. Muchun, Thanks. > > Hugh