From: Dave Chinner <david@fromorbit.com>
To: Matthew Wilcox <willy@infradead.org>
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: Tue, 11 Feb 2025 08:27:39 +1100 [thread overview]
Message-ID: <Z6pvS6uL7AYLHi9U@dread.disaster.area> (raw)
In-Reply-To: <Z6ptDG96_MrdN07R@casper.infradead.org>
On Mon, Feb 10, 2025 at 09:18:04PM +0000, Matthew Wilcox wrote:
> 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;
This still allows -ENOMEM to escape to userspace instead of -EAGAIN
via pwritev2(RWF_NOWAIT) and AIO write interfaces.
-Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2025-02-10 21:27 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
2025-02-10 21:27 ` Dave Chinner [this message]
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=Z6pvS6uL7AYLHi9U@dread.disaster.area \
--to=david@fromorbit.com \
--cc=avi@scylladb.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 \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.