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 2E27CC433EF for ; Tue, 28 Jun 2022 23:21:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D7F28E0001; Tue, 28 Jun 2022 19:21:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 886236B0072; Tue, 28 Jun 2022 19:21:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7751F8E0001; Tue, 28 Jun 2022 19:21:58 -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 67F626B0071 for ; Tue, 28 Jun 2022 19:21:58 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3CAD56041E for ; Tue, 28 Jun 2022 23:21:58 +0000 (UTC) X-FDA: 79629219516.07.AAD2BD5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id A86D440017 for ; Tue, 28 Jun 2022 23:21:57 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B763F61B2A; Tue, 28 Jun 2022 23:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BB57C341C8; Tue, 28 Jun 2022 23:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656458516; bh=mvd108VoYWDpztrLlNxd/Ocw8JptaMrNIfozkzNfEyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pm5TaYlbrZy4ar+PW/ZRulRugpktmXUTZggQFy5cFGcWRiZCHgd/ZVhusgmkiqwbp rvp/NWy3soV23NmZzKhhtBV6wEuDl4O9at1/7oROEgWyovUduFB5Wp47gjBc8tyHTz JH7XBKheqgh+dp2DipEHKADDxDIaBYa8UDIF5HyMZMqtVlnLJF/AkviXVVG6nYiS9i 4TAu+NcV+zjVyTWo+ohlW8zzCYNm7iJb+/oxDCUIpVzU+K/DfXocoLFagDVaydCFC+ RKLyaQeG5qnTvh9dpE9+hg4IArGHoJwzMG0VLrQGqAlpvCYeGaHNmplkaQwqfriTW/ H0tmEYzsPzE4w== Date: Tue, 28 Jun 2022 16:21:55 -0700 From: "Darrick J. Wong" To: Dave Chinner Cc: Matthew Wilcox , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , linux-mm@kvack.org Subject: Re: Multi-page folio issues in 5.19-rc4 (was [PATCH v3 25/25] xfs: Support large folios) Message-ID: References: <20211216210715.3801857-26-willy@infradead.org> <20220628073120.GI227878@dread.disaster.area> <20220628221757.GJ227878@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220628221757.GJ227878@dread.disaster.area> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656458517; a=rsa-sha256; cv=none; b=npeI3+BRlCqYrR6IujBMBTtJzuxyoU73ojSCgH6khk9qLJlS8eDPix+gcmKPLAis5ugSpp fj++g9V5WFqT4o4+aqu7FHM6YmZhOJ9kcCJkkF0lFwYPRuY9qgf+BD38eZb1u4ZuLUGpO3 dtEo1XCwyHYXLyQAtUhckL/2E3Pe2j8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pm5TaYlb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of djwong@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=djwong@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656458517; 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=n2y3I9oH55Wf6Lp8rqZFELsa066ZDsziG/xeDEJeGQA=; b=VXBVDzeV6HG51Gpe39C4nP9LOpZB4H7JL1VohVf+GnxchvS+A1SARbCYRL3BB6Ldrb6iCy lJk+xpXVCPDQ0DzaEG1EXkz7l2+BnuE5E7kGPs/0Gqb9yJ7FALkEZaxsENrt5IFfi1DPFN GdsuhMQVWGDNpBQjY6ERe4Rmeljaxo0= X-Stat-Signature: r9aucwpibbrr4gyw68njokwwmtsapk4s X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A86D440017 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pm5TaYlb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of djwong@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=djwong@kernel.org X-HE-Tag: 1656458517-147398 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: On Wed, Jun 29, 2022 at 08:17:57AM +1000, Dave Chinner wrote: > On Tue, Jun 28, 2022 at 02:18:24PM +0100, Matthew Wilcox wrote: > > On Tue, Jun 28, 2022 at 12:31:55PM +0100, Matthew Wilcox wrote: > > > On Tue, Jun 28, 2022 at 12:27:40PM +0100, Matthew Wilcox wrote: > > > > On Tue, Jun 28, 2022 at 05:31:20PM +1000, Dave Chinner wrote: > > > > > So using this technique, I've discovered that there's a dirty page > > > > > accounting leak that eventually results in fsx hanging in > > > > > balance_dirty_pages(). > > > > > > > > Alas, I think this is only an accounting error, and not related to > > > > the problem(s) that Darrick & Zorro are seeing. I think what you're > > > > seeing is dirty pages being dropped at truncation without the > > > > appropriate accounting. ie this should be the fix: > > > > > > Argh, try one that actually compiles. > > > > ... that one's going to underflow the accounting. Maybe I shouldn't > > be writing code at 6am? > > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index f7248002dad9..4eec6ee83e44 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -18,6 +18,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -2439,11 +2440,15 @@ static void __split_huge_page(struct page *page, struct list_head *list, > > __split_huge_page_tail(head, i, lruvec, list); > > /* Some pages can be beyond EOF: drop them from page cache */ > > if (head[i].index >= end) { > > - ClearPageDirty(head + i); > > - __delete_from_page_cache(head + i, NULL); > > + struct folio *tail = page_folio(head + i); > > + > > if (shmem_mapping(head->mapping)) > > shmem_uncharge(head->mapping->host, 1); > > - put_page(head + i); > > + else if (folio_test_clear_dirty(tail)) > > + folio_account_cleaned(tail, > > + inode_to_wb(folio->mapping->host)); > > + __filemap_remove_folio(tail, NULL); > > + folio_put(tail); > > } else if (!PageAnon(page)) { > > __xa_store(&head->mapping->i_pages, head[i].index, > > head + i, 0); > > > > Yup, that fixes the leak. > > Tested-by: Dave Chinner Four hours of generic/522 running is long enough to conclude that this is likely the fix for my problem and migrate long soak testing to my main g/522 rig and: Tested-by: Darrick J. Wong --D > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com