Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp69255iog; Tue, 28 Jun 2022 16:36:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1siI7ec+U3tOsQV+0VUg6G4XplQ17zyhRdnxkr9GoMEv3f+ErjortduQagvNJ7xIqLOXbZa X-Received: by 2002:a17:906:58ca:b0:726:a809:e308 with SMTP id e10-20020a17090658ca00b00726a809e308mr572895ejs.392.1656459409289; Tue, 28 Jun 2022 16:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656459409; cv=none; d=google.com; s=arc-20160816; b=tUq+zX9ZJDR7RHYojxyfGmu2qjzb/1Oe8dNTaeSWAzpuYjfgsZy4ckQN/yHGIDvV1n diEVCw6giwaovIBUtN4gcccNzdQHabUfvszoOv7HV1R5VT5SB2CQIuk5RqWJaC7EgC0T s+wo6boxyJXY91GUVs1hUhQ+72aT3g8ylTDG1i9B7eSrBSj0ex16RpTR+MegQg0UauMz 5hLnSWR40jP8xaCruBhvVCT45SUdzDq3TsRL66r4T4gmKNS3QJ8MeRnXHMTvgiJgwXiq 6z14+4E3EES9Kj1Frp7LTV/BDyaLSQwlLoDd0RXomA3NN/jBXvC6JBom77af73sLSdgO CPGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=n2y3I9oH55Wf6Lp8rqZFELsa066ZDsziG/xeDEJeGQA=; b=oUdyt4UESXxAWOwXt0Hi4sf+sJ97kLvnSCMNbhASrO9RatkSli3IT8OnpXPTSPQf0l d1/+zi4rLmwn6lRXKwa15fQEwO0naeXt1AWwvnC7YGPoxSMZpn1EE+uKMUPyT2TR3OjA TT7NqxgCiNaeAsQtuh8/H1aceNLIApoDD9ee1KE2a+HS4dEmgM4e0FATlmmwiyvSnytU YP4p1wmKlUNRn9ee6tV+1+RHllK55J1vmJ0uk1IoxhCz4XILV2vx9I1pFLgkSLXlOlyr ZwSaCM+hjz4ITppF/OfEjSZqYMBE1J21oEji4Ii8dHuTDXzxLOpIs+bIOIa8y5m4eDqN U+eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pm5TaYlb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz1-20020a1709072ce100b00711d56acfecsi20556143ejc.550.2022.06.28.16.36.23; Tue, 28 Jun 2022 16:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pm5TaYlb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229917AbiF1XWA (ORCPT + 99 others); Tue, 28 Jun 2022 19:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbiF1XV6 (ORCPT ); Tue, 28 Jun 2022 19:21:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AF6931232; Tue, 28 Jun 2022 16:21:57 -0700 (PDT) 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 B793D61B48; 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> X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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