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 13B7CC54798 for ; Sat, 9 Mar 2024 08:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 731E86B0074; Sat, 9 Mar 2024 03:05:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E23B6B0075; Sat, 9 Mar 2024 03:05:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AA8F6B0078; Sat, 9 Mar 2024 03:05:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 488FC6B0074 for ; Sat, 9 Mar 2024 03:05:39 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1F07C1A092A for ; Sat, 9 Mar 2024 08:05:39 +0000 (UTC) X-FDA: 81876766398.07.43F19ED Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP id 7A3311C0007 for ; Sat, 9 Mar 2024 08:05:37 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709971537; 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; bh=U/Lw5hb+bz2OG7dGIniBjil6gX4yT6zMeGSGB1OBzuM=; b=KVqwyHTm61ZWos00oZqFjyvd3Xmi4VIsWkhul1iTit3K1I5FStxAkEClV+LTP475+1s4De zFv3SBEdpyqfwyyGVK35t0uAZlniRpUs8E+/NIsgGYJnyyCfwZVxogyc7bQ6iRIZJ/Df/H HHpwK3YqncSLnua5dGmEieDKPcLYKUA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709971537; a=rsa-sha256; cv=none; b=bPmwUIEXDezRRAaE8R7FYFCXhKSVJxi8L6gq3RN6tektJySDZ+P4bUaAs8NZUTGvdLo3A1 9VMUahpRnUYl8UmDM4Y3C0C083Uwrv/fboGSzOVpVZ8VGaIBwvbDPE06vcD8X13k9rwzhS dFYR1LYiqJqyJhOjpxjy2uwvvh8gb3c= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D97F7C15; Sat, 9 Mar 2024 00:06:12 -0800 (PST) Received: from [10.57.67.186] (unknown [10.57.67.186]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D6EC3F73F; Sat, 9 Mar 2024 00:05:34 -0800 (PST) Message-ID: Date: Sat, 9 Mar 2024 08:05:33 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 10/18] mm: Allow non-hugetlb large folios to be batch processed Content-Language: en-GB To: Matthew Wilcox , Andrew Morton Cc: David Hildenbrand , Zi Yan , linux-mm@kvack.org, Yang Shi , Huang Ying References: <7415b36c-b5d3-4655-92e1-b303104bf4a9@arm.com> <644c2f60-dbb0-4fdb-8505-96f8101b2399@arm.com> <20240308203415.3379391ec00d5a66cf66dd5b@linux-foundation.org> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7A3311C0007 X-Rspam-User: X-Stat-Signature: m1ha3muu396tx68sw1btajwdj8ptabr1 X-Rspamd-Server: rspam01 X-HE-Tag: 1709971537-416554 X-HE-Meta: U2FsdGVkX18ISNkqW+9DlkGDktlyxnOT35RbWsg5n9B7fy/OoZUscPdC0ETiRC3wWiJwXMt69wkVHa9EWi1WGKhPfnRB6hIZF1+oLYmKCgRVyQcn7pJtuzdeKeX3XBV7n4xwkMkCRdFVeEXGdHNZuXXW0zuuFNsdGwHLi5oQQ62kMSwPTLDHDjRALmeTy1JstmCGxgzHEkML9ln3Pz2Vgc4JofMA6tav+dHV1wN0vTQGa0x7upna1LNFu74acRQ+FwNqwc3Eza8l8oHBkpmLO1zUt3yB1aGK/vrp8nvqqeU7Kt8cf0MAqyX3v1808aRKLNfVGVGI+B0s+n8IluGbSxVIjhMC4GHZh+JaCxuyEEx3dd/2hw8ABpU3Fl62PEkHTJwswsm8FgZEUZNAeKzHTqNvs/2vn5JSDeWMkja0MU6+UCdH8NWL0+aWCKfh1G1jJ9Fb6FSYd0Jow5wCfwTRUkrfI0UGZkFSGVqS9K6IL9DBAjaptZsziu6Bot0N/lk3Yyuh+Wd2me0mzKx1rk7imknb0L1Rcq9V1cnMYXevmspXWtB6oFbSfvjPe+MEwUaupzVSh+1gc2rImKCkiJbklSqC+GxzRJMZ2M8M0i0z4lKGZ8we10cJ1yZfJvmH8ekey/pxTu4LV6zlBycVuoU9JNjqp+48fckXhwonCTtgiYQlWJpyQidSJoCA5EBTTVJF78Fg5OkvHiMpx5k/Mlby1IzUiW0olHXhb2zkcdDSu8I6iPQtH4svFwLF/p5p3jtnQfxArs14ff3oqJfBC857M0a7Z2hshpUKMRbNi3PD4D366oVUCSAaJk6djQFO7LcW/CQSMm7oFbXjRLAKd61WDKSk7TDsZa6h 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 09/03/2024 04:52, Matthew Wilcox wrote: > On Fri, Mar 08, 2024 at 08:34:15PM -0800, Andrew Morton wrote: >> >> We seem to be coming down to the wire on this one - Linus might release >> 6.8 this weekend. >> >> Will simply dropping "mm: allow non-hugetlb large folios to be batch >> processed" from mm-stable get us out of trouble? > > We can add a fix patch which re-narrows the race to the point where it's > no longer observable. Obviously we need to figure out what the real > problem is, but we could be going back a long way. We've definitely > found two bugs in the process of investigating the problem (of arguable > import; the migration one merely wastes memory temporarily and it's not > entirely clear that the wrong-lock problem definitely causes a crash) > > diff --git a/mm/swap.c b/mm/swap.c > index 6b697d33fa5b..7b1d3144391b 100644 > --- a/mm/swap.c > +++ b/mm/swap.c > @@ -1012,6 +1012,8 @@ void folios_put_refs(struct folio_batch *folios, unsigned int *refs) > free_huge_folio(folio); > continue; > } > + if (folio_test_large(folio) && folio_test_large_rmappable(folio)) > + folio_undo_large_rmappable(folio); > > __page_cache_release(folio, &lruvec, &flags); > I agree this is likely to re-hide the problems. But I haven't actually tested it on it's own without the other fixes. I'll do some more testing with your latest patch and if that doesn't lead anywhere, I'll test with this on its own to check that I can no longer reproduce the crashes. If it hides them, I think this is the best short-term solution we have right now.