From: Andrew Morton <akpm@linux-foundation.org>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
reiserfs-devel@vger.kernel.org
Subject: Re: [RFC 1/1] fs/reiserfs/journal.c: Remove obsolete __GFP_NOFAIL
Date: Fri, 21 Mar 2014 13:00:55 -0700 [thread overview]
Message-ID: <20140321130055.c0ea32946f3543cd7f6bedd6@linux-foundation.org> (raw)
In-Reply-To: <20140321171830.ef47fdea1a3a2f2921c8fe86@skynet.be>
On Fri, 21 Mar 2014 17:18:30 +0100 Fabian Frederick <fabf@skynet.be> wrote:
> Loop around congestion_wait on allocation failure/alloc_journal_list
> like already fixed in other FS.
>
> ...
>
> --- a/fs/reiserfs/journal.c
> +++ b/fs/reiserfs/journal.c
> @@ -2487,8 +2487,13 @@ static int journal_read(struct super_block *sb)
> static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s)
> {
> struct reiserfs_journal_list *jl;
> - jl = kzalloc(sizeof(struct reiserfs_journal_list),
> - GFP_NOFS | __GFP_NOFAIL);
> +
> + do {
> + jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS);
> + if (unlikely(!jl))
> + congestion_wait(BLK_RW_ASYNC, HZ/50);
> + } while (!jl)
> +
Dammit, who has been running around converting __GFP_NOFAIL into
open-coded congestion_wait() loops?
The whole point of __GFP_NOFAIL is to centralise this
wait-for-memory-for-ever operation. So it is implemented in a common
(core) place and so that we can easily locate these problematic
callers.
This comment in ext4:
/*
* If __GFP_FS is not present, then we may be
* being called from inside the fs writeback
* layer, so we MUST NOT fail. Since
* __GFP_NOFAIL is going away, we will arrange
* to retry the allocation ourselves.
*/
is exactly wrong. Yes, we'd like __GFP_NOFAIL to go away, but it
cannot go away until buggy callsites such as this one are *fixed*.
Removing the __GFP_NOFAIL usage simply hides the buggy code from casual
searchers.
argh.
What we should do is to fix all these call sites so they can handle
memory exhaustion. That's hard so in the interim they should be using
__GFP_NOFAIL.
next prev parent reply other threads:[~2014-03-21 20:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 16:18 Fabian Frederick
2014-03-21 20:00 ` Andrew Morton [this message]
2014-03-21 23:21 ` Fabian Frederick
2014-03-21 23:27 ` Andrew Morton
2014-03-22 17:03 ` tytso
2014-03-22 17:15 ` Andrew Morton
2014-03-22 17:26 ` tytso
2014-03-22 17:32 ` tytso
2014-03-22 17:55 ` Andrew Morton
2014-03-22 18:12 ` tytso
2014-03-22 18:56 ` Joe Perches
2014-03-26 1:07 ` David Rientjes
2014-03-22 19:24 ` Dave Jones
2014-03-26 1:06 ` David Rientjes
2014-03-26 6:19 ` tytso
2014-03-26 6:32 ` Andrew Morton
2014-03-26 13:29 ` tytso
2014-03-27 4:38 ` David Rientjes
2014-03-22 21:13 ` Fabian Frederick
2014-03-24 14:00 ` One Thousand Gnomes
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=20140321130055.c0ea32946f3543cd7f6bedd6@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=fabf@skynet.be \
--cc=linux-kernel@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome