public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: "Raphael S. Carvalho" <raphaelsc@scylladb.com>,
	linux-xfs@vger.kernel.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, djwong@kernel.org, hch@lst.de,
	Avi Kivity <avi@scylladb.com>
Subject: Re: Possible regression with buffered writes + NOWAIT behavior, under memory pressure
Date: Mon, 10 Feb 2025 21:18:04 +0000	[thread overview]
Message-ID: <Z6ptDG96_MrdN07R@casper.infradead.org> (raw)
In-Reply-To: <Z6prC2fBbd6UE49r@dread.disaster.area>

On Tue, Feb 11, 2025 at 08:09:31AM +1100, Dave Chinner wrote:
> Better to only do the FGP_NOWAIT check when a failure occurs; that
> puts it in the slow path rather than having to evaluate it
> unnecessarily every time through the function/loop. i.e.
> 
>  		folio = filemap_alloc_folio(gfp, order);
> -		if (!folio)
> -			return ERR_PTR(-ENOMEM);
> +		if (!folio) {
> +			if (fgp_flags & FGP_NOWAIT)
> +				err = -EAGAIN;
> +			else
> +				err = -ENOMEM;
> +			continue;
> +		}

Or would we be better off handling ENOMEM the same way we handle EAGAIN?
eg something like:

+++ b/io_uring/io_uring.c
@@ -1842,7 +1842,7 @@ void io_wq_submit_work(struct io_wq_work *work)

        do {
                ret = io_issue_sqe(req, issue_flags);
-               if (ret != -EAGAIN)
+               if (ret != -EAGAIN || ret != -ENOMEM)
                        break;

                /*


  reply	other threads:[~2025-02-10 21:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 18:12 Possible regression with buffered writes + NOWAIT behavior, under memory pressure Raphael S. Carvalho
2025-02-10 18:20 ` Raphael S. Carvalho
2025-02-10 18:34   ` Raphael S. Carvalho
2025-02-10 21:09 ` Dave Chinner
2025-02-10 21:18   ` Matthew Wilcox [this message]
2025-02-10 21:27     ` Dave Chinner

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=Z6ptDG96_MrdN07R@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=avi@scylladb.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=raphaelsc@scylladb.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