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 101B3C54791 for ; Sun, 10 Mar 2024 13:38:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 337C36B006E; Sun, 10 Mar 2024 09:38:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E6FA6B0072; Sun, 10 Mar 2024 09:38:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AEB76B0074; Sun, 10 Mar 2024 09:38:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0B28A6B006E for ; Sun, 10 Mar 2024 09:38:36 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AB3FFA0B8A for ; Sun, 10 Mar 2024 13:38:35 +0000 (UTC) X-FDA: 81881234190.16.3B87C6A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id 49C7A14001A for ; Sun, 10 Mar 2024 13:38:33 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=c9MEbD9a; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710077914; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Q0zWU+ARTsAIidvMlMbTYmszEJsLVAxbwzT/6J77WtM=; b=X+dIlG/rR3gcEwCuVvmjR9o3TLvgSyX8QDWXL0cB8eJelUo0p88n5kwEbP7lxAl3rNyrqT DLyD0svvfrPhK4m1NZNKAItdvfU1AoFpDmNeSokSzBxDtZ/G3U0ycEu0Z5T+HxDq5MOMIE MP0JLA0C54FaCAfCTtIaa1GGzxoeAwg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710077914; a=rsa-sha256; cv=none; b=uwhduNByG621RWNpnqdgonbLUWcQPGn7Pp1ms73CCWUVy27GCzS36ZUksI0UpqJigtVRrp 6L5KSu8gJspWs7vpfWUAX4yHUNGYMzMbvMb/qgCXco6zaQeowqWs3/6mKQ5mILkTF28Tcc AqytCSZvubkAS2gHJ+FEEJNaerxPl28= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=c9MEbD9a; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Q0zWU+ARTsAIidvMlMbTYmszEJsLVAxbwzT/6J77WtM=; b=c9MEbD9arpULz/0IRSgwDToewQ rd0wUrcXkO3UqshOORGQsm6F+h1LikYBzv8D4XDup27BE0sYjAn2kUum+J4wEmdrIPbSJLYq27zoX 6lw57D6HmoA3VC9+YnS3PcfRolwXlpT5T18qf+YzLQFKIFhgeU2rSvV61xGniWdUGaXEsTwAbFRJN FC9ZfGYhGoURnpNbjuQ42B+Zd1xkWinsVp7oCFPztlhaGsIZV48Jg0Qb8rMWanJauuyLi8WMf3zst NuDxc7O74j00pPBORLHLHViz7Ydfhwqs1ZUKX74+tEEJKns9a+7ph8lphpqdmMENo6BAeks0Bcrpv MtK347Xg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjJNj-0000000G24q-0hM2; Sun, 10 Mar 2024 13:38:27 +0000 Date: Sun, 10 Mar 2024 13:38:27 +0000 From: Matthew Wilcox To: Ryan Roberts Cc: Andrew Morton , David Hildenbrand , Zi Yan , linux-mm@kvack.org, Yang Shi , Huang Ying Subject: Re: [PATCH v3 10/18] mm: Allow non-hugetlb large folios to be batch processed Message-ID: References: <644c2f60-dbb0-4fdb-8505-96f8101b2399@arm.com> <20240308203415.3379391ec00d5a66cf66dd5b@linux-foundation.org> <748cb10a-c4c4-4517-b1df-72ccb7d55c60@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <748cb10a-c4c4-4517-b1df-72ccb7d55c60@arm.com> X-Stat-Signature: c5fcb1gaysyr65ank7idhfzka9jymqp4 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 49C7A14001A X-Rspam-User: X-HE-Tag: 1710077913-92014 X-HE-Meta: U2FsdGVkX18B7sCvhVv4xnR7sVBQK3QstDmMB41J/ko1HFaRrn38juwyP8WtQhOpPtsXpHxVhe00MAzSn9dQE1kpW2jRy6OVo7FudADQhQWeHcyXqjBVcu/5jjAddw2pOPaPjkILjRjHivhPfly9fTIpF3+mSr9us+Oq33J7rSP/O83XVX61la41mkU5SsClOlbTNZ28AC5yW89k80y7BquAuqavo1tnp+vDMXrVNrsHM4HvQprEXks3U5nGfMFDFSMRnH/W6NPMseiqqyb7XazsigsrnNMii7WgJnHbBAOz/CkHI8m6oJREROHHcOzBSuWKlbYUsaVaCBVfO1m+OqZog8h9JAD+6bn17RAiW9PaPUnIeFu62YLFm8zVBr0fFAG9911Pciwe5GF4yh8eIbrYHtSaCFiC/lcHN3p2rx0ZvOiW1/h/uyI3lKTwqMKHrHVmZF5BP55Pa6+JpSLrKNUVM18rlU1BI2+sGwMQlAdepzde+eQXin81Q9pFymWD2FUlXyRMtZTiS3FwlnMuxK4Ml1dTOQTAbiScgZgqMl/3tyE9UwsSc8Jj3jEtuB5xH68QpPz4I6uLL0vo2G2VfktwuIur995BfTIR4vJRk68q1BWBgBl6kAOC57F+SKKKdTG9neuOSsZNXs/CHDKLXSaLcL1YBHFHpMwRwC3c5K6kNPpdZ0VovDtCSLmbpOENWX3NVLIgROeqg6saEgLyviylrqB0K5vH3yalgA+5bTbjvwsmDbjtDKOwvpyIgw68ZsKIibDH9FkSMw4at2trP46+YRkPkHYNUn8vk7WJlDJ2A/I5sb5nggjm7h2HZB75wqnA6IGmR2z8o2KA88alQPiwjF6OfwfoK1P17OXJH66GQ0PVNOEujqDVZcnbRiTx+Km5gOzYXbGYeiPu1mCpgnf+RDYBFQUC/BJzoLYJ0PYSZsesvXDIEKT0NUDmp0LfuPgfYWoF3CSAmj3z4u2 06BkXtmN 7ux3e+c3UORbLXax2Jq+GMIGIiCf8UJ51h4Epk09FqDefB7te/BCmTzEwVlVZ48VADPnpEosTjiZhiLa6avt9eBM5386hvqwyxE1u1FaW+lAr/sEbXKxLh85PRHLvazF4UPSLg4VItCFTYeE= 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 Sat, Mar 09, 2024 at 12:33:44PM +0000, Ryan Roberts wrote: > >> 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. > > I've tested this workaround on immediately on top of commit f77171d241e3 ("mm: > allow non-hugetlb large folios to be batch processed") and can't reproduce any > problem. I've run the test 32 times. Without the workaround, the biggest number > of test repeats I've managed before seeing a problem is ~5. So I'm confident > this will be sufficient as a short-term solution. Let's make this the 6.9 solution. Having looked at a lot of bits of the page freeing path, I'll do some significant rearranging for 6.10, but this is tested and time is short. Proper patch shortly.