Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1876iog; Tue, 28 Jun 2022 14:57:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFJ0Gq6nnbyYIEBc3/Fwi4Y4QKyERNqB3F+Jr3PGyzuzqaelwoDt21K+0d9zc+HacKTcNu X-Received: by 2002:a17:903:32c8:b0:16a:6b37:7caa with SMTP id i8-20020a17090332c800b0016a6b377caamr5526941plr.143.1656453438124; Tue, 28 Jun 2022 14:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656453438; cv=none; d=google.com; s=arc-20160816; b=hyPK/vpm6FSoIntgPyN2eZ4RS/Rm8EYElNu7SOwVX9Tbc2MHJjGX7RNEgvdyZBmJRh AuvE7CUYX5qN2Snl1TlHaxLeNjzuTX/rhyizHXB5Y5ermyakV+9WE9sWwRrH3MClp+aZ AUt5XNJUAfk0VEWkxHzdRxt1EnQWxyc60TfIRtNdjwDSwhHBWRrxf4q+yFd0tbkFw+j/ QDebc0BlCMzi9mQ9y3ftmGwYBGnVAyHFFxEYuffctMRTPEtBY8k9yB4zvhQTKmkZt8Wn DzlfYNGvVdzJ6gaFyAMVJNkYQn3g5tYigPJ1f/CJvjFOkMPAi3uAusQsf4cOPkmweaaF G7MA== 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=s3kwSLGxTPl66LibtIep5hoR5Z0HcfSIUoC4mH8amW4=; b=n2YIi8L7M4fylWmQSrUZEZZgNCdwWuceBN7YiH4lTL9cm/SH+UM/WdBQAWPJckIAjX kfnAelRjOIMzQcsr5qvzWLa+n7bth4FISrfL5wMTT1w8qbtgrXR9zy3G0wVj6M0bnW1f caTZbIWgJvUCGXRMZ+64Pp85RstnzVawg55BgwcVaG5FooukgC6ZP2O+8VLEXSBVCHtS x8yHhrrsMjy6QZ3qp5obHuBhzyph/tB8bsMgpl4E6or3nhq1PC09ke4tsNApIQ3FhVna 8Ep0j9neHUA+SF50ZM9r7F5AulC4O6BkF7ONKErmbpzpWpId8ajxXmP7GmPAtIq0Ca7t E6vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZvOztGuB; 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 v10-20020a63b64a000000b003fce4535435si22256892pgt.483.2022.06.28.14.57.01; Tue, 28 Jun 2022 14:57:18 -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=ZvOztGuB; 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 S230190AbiF1U5O (ORCPT + 99 others); Tue, 28 Jun 2022 16:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiF1U5M (ORCPT ); Tue, 28 Jun 2022 16:57:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1724838DA8; Tue, 28 Jun 2022 13:57:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id CD56DB81F8C; Tue, 28 Jun 2022 20:57:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86F0DC341C8; Tue, 28 Jun 2022 20:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656449829; bh=JYjpGNT6iEQTqD1KKuuhn/8Y9wh6ZQGSQyJkPuIoo+8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZvOztGuB2lWfBDSlogHmcoiTa/KqdhlmdFnYHIGLR/JnJA89NgtoYgugSdXnJzAYy xs4vORpyPVQqXK63ZGVHbgXzSnZ8lDPULFeXe2t9hIrQTOp5ZSEU/lh7t+M+mQKJQr 7OO8yBZEr1tgdZcLSEfDDnJVPR1BVRHvssPcSLJ5TmRF89QdniFCZO12YAhFFQD3LN a1uc5cO/+uXCRpjkv8EXGyF0Am+kHLfyj9r6gVPCXhJZV/vekNCssNF8CHgZDXPhij VWjyOD5cpcC+KSQLJHCwyHl6XALIgaf5Yz0X6Wl8aZkeSQCeUyYNsYHKLdPusdl6qK ktmiW5J2fPNwQ== Date: Tue, 28 Jun 2022 13:57:09 -0700 From: "Darrick J. Wong" To: Matthew Wilcox Cc: Dave Chinner , 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-1-willy@infradead.org> <20211216210715.3801857-26-willy@infradead.org> <20220628073120.GI227878@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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? I dunno, it's been running on my test VMs for 160 minutes (same debug setup as yesterday) and 100 minutes (regular g/522, no -C/-I flags to fsx, no debugging junk) and neither have reported corruptions. $ grep Dirty /proc/meminfo Dirty: 100 kB So, pretty good for writing code at 6am while on holiday. I'll let this run overnight, but I think you've fixed the problem, at least for me... --D > 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);