linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: David Howells <dhowells@redhat.com>
Cc: Steve French <stfrench@microsoft.com>,
	Vishal Moola <vishal.moola@gmail.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Paulo Alcantara <pc@cjr.nz>,
	 Matthew Wilcox <willy@infradead.org>,
	Huang Ying <ying.huang@intel.com>,
	 Baolin Wang <baolin.wang@linux.alibaba.com>,
	Xin Hao <xhao@linux.alibaba.com>,
	 linux-mm@kvack.org, mm-commits@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] cifs: Fix cifs_writepages_region()
Date: Fri, 24 Feb 2023 08:06:16 -0800	[thread overview]
Message-ID: <CAHk-=whFKL4VuFBWvenG8fAgfvbf36PDgouUSx47rZDWr9BkJw@mail.gmail.com> (raw)
In-Reply-To: <2213409.1677249075@warthog.procyon.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

On Fri, Feb 24, 2023 at 6:31 AM David Howells <dhowells@redhat.com> wrote:
>
> Here's the simplest fix for cifs_writepages_region() that gets it to work.

Hmm. The commit message for this is wrong.

> Fix the cifs_writepages_region() to just skip over members of the batch that
> have been cleaned up rather than retrying them.

It never retried them. The "skip_write" code did that same

                        start += folio_size(folio);
                        continue;

that your patch does, but it *also* had that

                        if (skips >= 5 || need_resched()) {

thing to just stop writing entirely.

> I'm not entirely sure why it fixes it, though.

Yes. Strange. Because it does the exact same thing as the "Oh, the
trylock worked, but it was still under writeback or fscache" did. I
just merged all the "skip write" cases.

But the code is clearly (a) not working and (b) the whole skip count
and need_resched() logic is a bit strange to begin with.

Can you humor me, and try if just removing that skip count thing
instead? IOW, this attached patch? Because that whole "let's stop
writing if we need to reschedule" sounds truly odd (we have a
cond_resched(), although it's per folio batch, not per-folio), and the
skip count logic doesn't make much sense to me either.

SteveF?

              Linus

[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 875 bytes --]

 fs/cifs/file.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 5365a3299088..7061d263315d 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2858,7 +2858,6 @@ static int cifs_writepages_region(struct address_space *mapping,
 				  loff_t start, loff_t end, loff_t *_next)
 {
 	struct folio_batch fbatch;
-	int skips = 0;
 
 	folio_batch_init(&fbatch);
 	do {
@@ -2927,17 +2926,6 @@ static int cifs_writepages_region(struct address_space *mapping,
 			return ret;
 
 skip_write:
-			/*
-			 * Too many skipped writes, or need to reschedule?
-			 * Treat it as a write error without an error code.
-			 */
-			if (skips >= 5 || need_resched()) {
-				ret = 0;
-				goto write_error;
-			}
-
-			/* Otherwise, just skip that folio and go on to the next */
-			skips++;
 			start += folio_size(folio);
 			continue;
 		}

  reply	other threads:[~2023-02-24 16:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 21:52 [GIT PULL] MM updates for 6.3-rc1 Andrew Morton
2023-02-21 23:36 ` Andrew Morton
2023-02-24  1:33 ` pr-tracker-bot
2023-02-24  1:33 ` Linus Torvalds
2023-02-24  1:56   ` Andrew Morton
2023-02-24  3:01   ` Huang, Ying
2023-02-24  9:04 ` David Howells
2023-02-24 12:12 ` David Howells
2023-02-24 14:31 ` [RFC][PATCH] cifs: Fix cifs_writepages_region() David Howells
2023-02-24 16:06   ` Linus Torvalds [this message]
2023-02-24 16:11   ` Matthew Wilcox
2023-02-24 17:15   ` David Howells
2023-02-24 18:44     ` Matthew Wilcox
2023-02-24 20:13     ` David Howells
2023-02-24 20:16       ` Linus Torvalds
2023-02-24 20:45         ` Matthew Wilcox
2023-02-27 13:20         ` David Howells
2023-02-24 20:58       ` David Howells
2023-02-24 17:19   ` David Howells
2023-02-24 18:58     ` Linus Torvalds
2023-02-24 19:05       ` Linus Torvalds
2023-02-24 22:11         ` [EXTERNAL] " Steven French
2023-03-01 18:32         ` Steven French
2023-02-24 14:48 ` [RFC][PATCH] cifs, afs: Revert changes to {cifs,afs}_writepages_region() David Howells
2023-02-24 16:13   ` Linus Torvalds
2023-02-24 15:13 ` [RFC][PATCH] cifs: Improve use of filemap_get_folios_tag() David Howells
2023-02-24 16:22   ` Linus Torvalds
2023-02-24 17:22   ` David Howells
2023-02-26  2:43 ` [GIT PULL] MM updates for 6.3-rc1 Linus Torvalds
2023-02-26  3:27   ` Linus Torvalds
2023-02-26  3:53     ` Linus Torvalds
2023-02-26  3:57       ` Andrew Morton
2023-02-26  4:03         ` Linus Torvalds
2023-02-26  4:12           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHk-=whFKL4VuFBWvenG8fAgfvbf36PDgouUSx47rZDWr9BkJw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=dhowells@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=pc@cjr.nz \
    --cc=stfrench@microsoft.com \
    --cc=vishal.moola@gmail.com \
    --cc=willy@infradead.org \
    --cc=xhao@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).