From: Peter Zijlstra <peterz@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Boaz Harrosh <bharrosh@panasas.com>, Ted Ts'o <tytso@mit.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: What am I doing wrong? submit_bio() suddenly stops working...
Date: Fri, 22 Oct 2010 15:04:20 +0200 [thread overview]
Message-ID: <1287752660.15336.37.camel@twins> (raw)
In-Reply-To: <4CC0817F.1020403@kernel.dk>
On Thu, 2010-10-21 at 20:07 +0200, Jens Axboe wrote:
>
> >> + do {
> >> + bio = bio_alloc(GFP_NOIO, nvecs);
> >> + nvecs >>= 1;
> >> + } while (bio == NULL);
> >
> > This is surly bad. bio_alloc must be allowed to fail
> > (Specially with GFP_NOIO). You should only loop down to
> > 1 and then prepare to return -ENOMEM from this function
> > and handle it properly in callers. (Or schedule and wait
> > like below)
>
> Since __GFP_WAIT is set, it'll never return NULL. And as long as you
> don't allocate more than 1 before doing you submit_bio(), it should be
> OK in this case.
__GFP_WAIT can return NULL, on OOM and when the size is over a magic
threshold.
I find it bad form to rely on any allocation not failing.
next prev parent reply other threads:[~2010-10-22 13:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 2:00 What am I doing wrong? submit_bio() suddenly stops working Theodore Ts'o
2010-10-21 6:59 ` Jens Axboe
2010-10-21 16:55 ` Ted Ts'o
2010-10-21 17:41 ` Boaz Harrosh
2010-10-21 18:07 ` Jens Axboe
2010-10-22 13:04 ` Peter Zijlstra [this message]
2010-10-22 14:08 ` Jens Axboe
2010-10-21 18:14 ` Ted Ts'o
2010-10-21 18:21 ` Jens Axboe
2010-10-21 17:46 ` Jens Axboe
2010-10-21 21:29 ` Ted Ts'o
2010-10-22 3:34 ` Ted Ts'o
2010-10-22 7:19 ` Jens Axboe
2010-10-23 14:48 ` Ted Ts'o
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=1287752660.15336.37.camel@twins \
--to=peterz@infradead.org \
--cc=axboe@kernel.dk \
--cc=bharrosh@panasas.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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.