From: Jens Axboe <jens.axboe@oracle.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH next] bio: zero inlined bio_vec
Date: Tue, 23 Dec 2008 12:39:38 +0100 [thread overview]
Message-ID: <20081223113938.GJ32491@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.64.0812231110320.9177@blonde.anvils>
On Tue, Dec 23 2008, Hugh Dickins wrote:
> On Tue, 23 Dec 2008, Jens Axboe wrote:
> > On Tue, Dec 23 2008, Jens Axboe wrote:
> > >
> > > That is, it iterates *bio_orig but indexes bio since it knows it has the
> > > same number of segments. So this code is the odd one out, I'd be
> > > surprised if we had more such cases. And since it would be nice to get
> > > rid of the need to memset in general, can you try with the below patch?
> >
> > Nope, that still wont be enough, since we leave entries 0..i-1
> > uninitialized. Lets just do this instead.
>
> Yes, that second version worked for me. But if __blk_queue_bounce()
> is indeed the odd one out (likely but not certain), then the extension
> below makes more sense - I don't like how your bio.c returns a cleared
> bio_vec in some cases but not in others. This is running fine for me
> on my test machines, but my test coverage is probably very poor (am I
> ever using more than the inlined bio_vec?), and I've not really tried
> to understand all the ways through bvec_alloc_bs().
>
> Hugh
>
> --- a/fs/bio.c
> +++ b/fs/bio.c
> @@ -180,7 +180,7 @@ struct bio_vec *bvec_alloc_bs(gfp_t gfp_
> * kzalloc() for the exact number of vecs right away.
> */
> if (!bs)
> - bvl = kzalloc(nr * sizeof(struct bio_vec), gfp_mask);
> + bvl = kmalloc(nr * sizeof(struct bio_vec), gfp_mask);
>
> /*
> * see comment near bvec_array define!
> @@ -237,9 +237,6 @@ fallback:
> }
> }
>
> - if (bvl)
> - memset(bvl, 0, bvec_nr_vecs(*idx) * sizeof(struct bio_vec));
> -
> return bvl;
> }
I agree, those should be killed too. It's why I didn't want to rely on
memset for fixing your issue :-)
I'll merge the bounce.c fix into the original patch.
--
Jens Axboe
prev parent reply other threads:[~2008-12-23 11:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-23 1:08 [PATCH next] bio: zero inlined bio_vec Hugh Dickins
2008-12-23 8:07 ` Jens Axboe
2008-12-23 10:15 ` Hugh Dickins
2008-12-23 10:23 ` Jens Axboe
2008-12-23 10:31 ` Jens Axboe
2008-12-23 11:21 ` Hugh Dickins
2008-12-23 11:39 ` Jens Axboe [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=20081223113938.GJ32491@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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