From: Andrew Morton <akpm@linux-foundation.org>
To: David Rientjes <rientjes@google.com>
Cc: Neil Brown <neilb@suse.de>, Alasdair G Kergon <agk@redhat.com>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 1/6] md: remove dependency on __GFP_NOFAIL
Date: Mon, 23 Aug 2010 12:26:06 -0700 [thread overview]
Message-ID: <20100823122606.47524cef.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1008161954310.17924@chino.kir.corp.google.com>
On Mon, 16 Aug 2010 19:57:51 -0700 (PDT)
David Rientjes <rientjes@google.com> wrote:
> Removes the dependency on __GFP_NOFAIL by looping indefinitely in the
> caller.
>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> drivers/md/dm-region-hash.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c
> --- a/drivers/md/dm-region-hash.c
> +++ b/drivers/md/dm-region-hash.c
> @@ -289,8 +289,12 @@ static struct dm_region *__rh_alloc(struct dm_region_hash *rh, region_t region)
> struct dm_region *reg, *nreg;
>
> nreg = mempool_alloc(rh->region_pool, GFP_ATOMIC);
> - if (unlikely(!nreg))
> - nreg = kmalloc(sizeof(*nreg), GFP_NOIO | __GFP_NOFAIL);
> + if (unlikely(!nreg)) {
> + /* FIXME: this may potentially loop forever */
> + do {
> + nreg = kmalloc(sizeof(*nreg), GFP_NOIO);
> + } while (!nreg);
> + }
>
> nreg->state = rh->log->type->in_sync(rh->log, region, 1) ?
> DM_RH_CLEAN : DM_RH_NOSYNC;
erm.
The reason for adding GFP_NOFAIL in the first place was my observation
that the kernel contained lots of open-coded retry-for-ever loops.
All of these are wrong, bad, buggy and mustfix. So we consolidated the
wrongbadbuggymustfix concept into the core MM so that miscreants could
be easily identified and hopefully fixed.
I think that simply undoing that change is a bad idea - it allows the
wrongbadbuggymustfix code to hide from view.
The correct way to remove __GFP_NOFAIL is to fix the
wrongbadbuggymustfix code properly.
next prev parent reply other threads:[~2010-08-23 19:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.DEB.2.00.1008161953430.17924@chino.kir.corp.google.com>
2010-08-17 2:57 ` [patch 1/6] md: remove dependency on __GFP_NOFAIL David Rientjes
2010-08-23 19:26 ` Andrew Morton [this message]
2010-08-23 19:35 ` David Rientjes
2010-08-23 19:51 ` Andrew Morton
2010-08-23 20:03 ` David Rientjes
2010-08-23 20:01 ` Andrew Morton
2010-08-23 20:08 ` David Rientjes
2010-08-23 20:23 ` Andrew Morton
2010-08-23 20:37 ` David Rientjes
2010-08-23 20:09 ` Pekka Enberg
2010-08-23 20:13 ` David Rientjes
2010-08-23 20:29 ` Pekka Enberg
2010-08-23 20:40 ` David Rientjes
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=20100823122606.47524cef.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=agk@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=rientjes@google.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).