linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@lst.de>
Cc: "Raphael S. Carvalho" <raphaelsc@scylladb.com>,
	linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	djwong@kernel.org, Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH v2] mm: Fix error handling in __filemap_get_folio() with FGP_NOWAIT
Date: Mon, 24 Feb 2025 15:33:29 +0000	[thread overview]
Message-ID: <Z7yRSe-nkfMz4TS2@casper.infradead.org> (raw)
In-Reply-To: <20250224141744.GA1088@lst.de>

On Mon, Feb 24, 2025 at 03:17:44PM +0100, Christoph Hellwig wrote:
> On Mon, Feb 24, 2025 at 05:13:28AM -0300, Raphael S. Carvalho wrote:
> > +		if (err) {
> > +			/* Prevents -ENOMEM from escaping to user space with FGP_NOWAIT */
> > +			if ((fgp_flags & FGP_NOWAIT) && err == -ENOMEM)
> > +				err = -EAGAIN;
> >  			return ERR_PTR(err);
> 
> I don't think the comment is all that useful.  It's also overly long.
> 
> I'd suggest this instead:
> 
> 			/*
> 			 * When NOWAIT I/O fails to allocate folios this could
> 			 * be due to a nonblocking memory allocation and not
> 			 * because the system actually is out of memory.
> 			 * Return -EAGAIN so that there caller retries in a
> 			 * blocking fashion instead of propagating -ENOMEM
> 			 * to the application.
> 			 */

I don't think it needs a comment at all, but the memory allocation
might be for something other than folios, so your suggested comment
is misleading.


  reply	other threads:[~2025-02-24 15:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  8:13 Raphael S. Carvalho
2025-02-24 14:17 ` Christoph Hellwig
2025-02-24 15:33   ` Matthew Wilcox [this message]
2025-02-24 15:45     ` Raphael S. Carvalho
2025-02-24 15:49       ` Matthew Wilcox
2025-02-24 15:50         ` Raphael S. Carvalho
2025-02-24 15:51           ` Matthew Wilcox
2025-02-24 15:52             ` Raphael S. Carvalho
2025-02-24 15:56             ` Christoph Hellwig
2025-02-24 16:02     ` Christoph Hellwig
2025-02-24 16:15       ` Raphael S. Carvalho
2025-02-25 16:04         ` Raphael S. Carvalho

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=Z7yRSe-nkfMz4TS2@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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