Message ID | 20230626173521.459345-1-willy@infradead.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7649744vqr; Mon, 26 Jun 2023 10:46:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iwfAZ3KelowCUa69hHO2nyLWMEqvECDPhJKBZDCF/7A15oO66LErFgR91fYTtr5kI5jo7 X-Received: by 2002:a17:907:160d:b0:989:3ae0:772a with SMTP id hb13-20020a170907160d00b009893ae0772amr16777946ejc.50.1687801583683; Mon, 26 Jun 2023 10:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687801583; cv=none; d=google.com; s=arc-20160816; b=SOonvakhtduR+SIjJFiV4icRsUihEKqSZNSKdcMBPgrvu2hoCUNG/f5R80hFB8QAKZ wyqdtwNa8TuaFp2W8lm1fxptKeYgSCOPYUmT1DTuAtPeGqCJ4oKZ64izcSh+bpB5fe9S qzfGLRd76FQbFgFgISi2aF78IaBHY4NTZBqceQYGfwfvDac4tkptQmuAnlcBTaj/r+Ol wmolXcz370XGWnQcLDuvn6u7vaxdFUjyFxbNTN5pCwcaFV4KC8p73yDeMS9JQvRcS+/X OdAPK6B72vykdPUAyfEwR98CGY5KzlrIUrFYSkITWPeebXkOQM2LeH56bSh7mf3+5hfe sHiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QSocI68SnxGROAi6KnsuaQtLU/TknPAXfYvMKgd/IsY=; fh=s6qbYcpKmY0AEsK/gKDpT3qiaGyyaU+hQ5h16uVwDEk=; b=x7tA7Aci/2CPy0Ac9M00MLhnsrl96UhDhxwUVumG/dgh/HggMMMtk5hG6idhLbbb5B GHSwfdZUGJkTGQs11fk5cqQdc5/ktV6TlyeYu3PL2Cqy2TmRO3K+d77aata2ZCItXxDa aOMj08VkDxGepE38lEutdYcPW4MAIB6K4h1QUdpht8BNYBHGubjtjhk50IOocLGyshIh i8IiBacX5XrWnlCHVXS9ZYI6HXh3IQP5dweve7N0RMYzG5/vMLyaVYCJ9E5WQ+9Z6IPE h1JU9oCAFTF6eVxP3ZXQnWS2BKeBuN2NESAXZPszGPmQBSa9bEi/QNOVdyK+GGigwjHx XfOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=duXZv5WH; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz20-20020a170906bb1400b0097394940619si3137992ejb.984.2023.06.26.10.45.57; Mon, 26 Jun 2023 10:46:23 -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=@infradead.org header.s=casper.20170209 header.b=duXZv5WH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbjFZRhA (ORCPT <rfc822;filip.gregor98@gmail.com> + 99 others); Mon, 26 Jun 2023 13:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjFZRgE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 26 Jun 2023 13:36:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EE4F2968; Mon, 26 Jun 2023 10:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=QSocI68SnxGROAi6KnsuaQtLU/TknPAXfYvMKgd/IsY=; b=duXZv5WH1H74olkGLz6lqhcWMg ycaQBDHoe0qUqHIgblnjFaUpUKwN8MGzm4avigX/QCt4cNL3uCwpYv+DTycTDK9TSw8XUkK7m8QwG Xx1hLohNCFLwjChZBPCwmdd3SfdAwlTEou4IxynYnkaQNaTVGLaSjbkiAj7mOVuqvbl+qv5P/w3Xv UEdx5tcwSg83Nx0/nnHphNfbPqk2EAzCNqIAfrFYAJqBhFMOAYjutv1w4XrJSjWAr7t9LOzNITzdY gijCkd6XiDvCxOfwKpwcTEonef52AtZir2Poqu6PPz0gLJFB0XwmCAgF1n0UVKH9Ow2NVWKicFnsA OfW3NJTg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qDq7X-001vUx-5v; Mon, 26 Jun 2023 17:35:23 +0000 From: "Matthew Wilcox (Oracle)" <willy@infradead.org> To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara <jack@suse.com>, David Howells <dhowells@redhat.com> Subject: [PATCH 00/12] Convert write_cache_pages() to an iterator Date: Mon, 26 Jun 2023 18:35:09 +0100 Message-Id: <20230626173521.459345-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769788232861053006?= X-GMAIL-MSGID: =?utf-8?q?1769788232861053006?= |
Series |
Convert write_cache_pages() to an iterator
|
|
Message
Matthew Wilcox
June 26, 2023, 5:35 p.m. UTC
Dave Howells doesn't like the indirect function call imposed by write_cache_pages(), so refactor it into an iterator. I took the opportunity to add the ability to iterate a folio_batch without having an external variable. This is against next-20230623. If you try to apply it on top of a tree which doesn't include the pagevec removal series, IT WILL CRASH because it won't reinitialise folio_batch->i and the iteration will index out of bounds. I have a feeling the 'done' parameter could have a better name, but I can't think what it might be. Matthew Wilcox (Oracle) (12): writeback: Factor out writeback_finish() writeback: Factor writeback_get_batch() out of write_cache_pages() writeback: Factor should_writeback_folio() out of write_cache_pages() writeback: Simplify the loops in write_cache_pages() pagevec: Add ability to iterate a queue writeback: Use the folio_batch queue iterator writeback: Factor writeback_iter_init() out of write_cache_pages() writeback: Factor writeback_get_folio() out of write_cache_pages() writeback: Factor writeback_iter_next() out of write_cache_pages() writeback: Add for_each_writeback_folio() iomap: Convert iomap_writepages() to use for_each_writeback_folio() writeback: Remove a use of write_cache_pages() from do_writepages() fs/iomap/buffered-io.c | 14 +- include/linux/pagevec.h | 18 +++ include/linux/writeback.h | 22 ++- mm/page-writeback.c | 310 +++++++++++++++++++++----------------- 4 files changed, 216 insertions(+), 148 deletions(-)
Comments
On Mon, Jun 26, 2023 at 06:35:09PM +0100, Matthew Wilcox (Oracle) wrote: > Dave Howells doesn't like the indirect function call imposed by > write_cache_pages(), so refactor it into an iterator. I took the > opportunity to add the ability to iterate a folio_batch without having > an external variable. > > This is against next-20230623. If you try to apply it on top of a tree > which doesn't include the pagevec removal series, IT WILL CRASH because > it won't reinitialise folio_batch->i and the iteration will index out > of bounds. > > I have a feeling the 'done' parameter could have a better name, but I > can't think what it might be. Heh, I actually have a local series with a minor subset of some of the cleanups, but without the iterator conversion.
Do you have this on a branch somewhere? David
On Tue, Jun 27, 2023 at 11:53:02AM +0100, David Howells wrote:
> Do you have this on a branch somewhere?
I just pushed it out to https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/writeback-iter
Running it through xfstests now. This includes one of Christoph's
suggestions, a build fix for Linus's tree, and a bugfix I noticed last
night, so it's not quite the same as the emails that were sent out in
this thread. I doubt it'll be what I send out for v2 either.
I'm looking at afs writeback now.
Matthew Wilcox <willy@infradead.org> wrote: > I'm looking at afs writeback now. :-) > fs/iomap/buffered-io.c | 14 +- > include/linux/pagevec.h | 18 +++ > include/linux/writeback.h | 22 ++- > mm/page-writeback.c | 310 +++++++++++++++++++++----------------- > 4 files changed, 216 insertions(+), 148 deletions(-) Documentation/mm/writeback.rst too please. David
On Wed, Jun 28, 2023 at 09:03:10PM +0100, David Howells wrote: > Matthew Wilcox <willy@infradead.org> wrote: > > > I'm looking at afs writeback now. > > :-) > > > fs/iomap/buffered-io.c | 14 +- > > include/linux/pagevec.h | 18 +++ > > include/linux/writeback.h | 22 ++- > > mm/page-writeback.c | 310 +++++++++++++++++++++----------------- > > 4 files changed, 216 insertions(+), 148 deletions(-) > > Documentation/mm/writeback.rst too please. $ ls Documentation/mm/w* ls: cannot access 'Documentation/mm/w*': No such file or directory $ git grep writeback Documentation/mm Documentation/mm/multigen_lru.rst:do not require TLB flushes; clean pages do not require writeback. Documentation/mm/page_migration.rst:2. Ensure that writeback is complete. Documentation/mm/page_migration.rst:15. Queued up writeback on the new page is triggered. Documentation/mm/physical_memory.rst:``nr_writeback_throttled`` Documentation/mm/physical_memory.rst: Number of pages written while reclaim is throttled waiting for writeback. Or are you suggesting I write a new piece of kernel documentation? If so, I respectfully decline. I've updated the kernel-doc included in Documentation/core-api/mm-api.rst and I think that's all I can reasonably be asked to do.
Just curious where this did end up. I have some changes that could use or conflict with this depending on your view. They aren't time critical yt, but if we're going to the road in this series I'd appreciate if we'd get it done rather sooner than later :)
On Wed, Jun 28, 2023 at 08:31:05PM +0100, Matthew Wilcox wrote: > On Tue, Jun 27, 2023 at 11:53:02AM +0100, David Howells wrote: > > Do you have this on a branch somewhere? > > I just pushed it out to https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/writeback-iter > > Running it through xfstests now. This includes one of Christoph's > suggestions, a build fix for Linus's tree, and a bugfix I noticed last > night, so it's not quite the same as the emails that were sent out in > this thread. I doubt it'll be what I send out for v2 either. So it turns out thіs version still applies fine and tests fine with latest mainline. I've put up a slight tweak here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/writeback-iter this moves and documents the new fields in struct writeback_control and drops the iomap patch for now as it has conflicts in the VFS tree in this merge window. Do you want me to send this version out, or do you want to take over or is there a good reason not to progress with it?